Search code examples
visual-studio-2015xamarin.androidwechatxamarin-binding

Xamarin JAR Binding Library


I'm trying to binding WeChat SDK into Xamarin using .jar file from WeChat SDK Downloads.

I had follow the tutorials from here. Unfortunately, I'm having these 2 issues when trying to rebuild the solutions:

  • Severity Code Description Project File Line Suppression State Error CS0102 The type 'BaseResp' already contains a definition for 'ErrCode'

  • Severity Code Description Project File Line Suppression State Error CS0102 The type 'WXMediaMessage' already contains a definition for 'MediaObject'

Can you guys give me some guidance please. Thanks in advance for help. :)


Solution

  • I solved this by editing code of Metadata.xml inside folder Transforms.

    Just add 2 lines of code. After this, clean and build your solutions:

    <attr path="/api/package[@name='com.tencent.mm.sdk.modelbase']/class[@name='BaseResp']/field[@name='errCode']" name="managedName">errCode</attr>
    <attr path="/api/package[@name='com.tencent.mm.sdk.modelmsg']/class[@name='WXMediaMessage']/field[@name='mediaObject']" name="managedName">mediaObject</attr>
    

    Note: You can double-clicked on the errors to navigate you to the corresponding XPath field reference.

    Image

    For more information, read Java Bindings Metadata.