Bug 5844 - Cannot bind PayPal library with Mono for Android
Summary: Cannot bind PayPal library with Mono for Android
Status: RESOLVED FEATURE
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 4.2.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2012-06-25 09:42 UTC by Chris Hardy [MSFT]
Modified: 2012-07-03 12:25 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Chris Hardy [MSFT] 2012-06-25 09:42:00 UTC
Find the reproducible issue in the following project: https://www.dropbox.com/s/y9kvhthxnvqhwqv/PayPalAndroidBinding.zip

I get the following error: /Library/Frameworks/Mono.framework/External/xbuild/Novell/Xamarin.Android.Bindings.targets: Error: Tool exited with code: 1. Output: Type com.paypal.android.MEP.a.a: FxDG naming violation: Type name 'a' matches namespace part 'A'.
Type com.paypal.android.MEP.b.b: FxDG naming violation: Type name 'b' matches namespace part 'B'.
Type com.paypal.android.a.a: FxDG naming violation: Type name 'a' matches namespace part 'A'.
Type com.paypal.android.a.a.a: FxDG naming violation: Type name 'a' matches namespace part 'A'.
Type com.paypal.android.b.b: FxDG naming violation: Type name 'b' matches namespace part 'B'.
resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/mscorlib.dll
resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.dll
resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.Xml.dll
resolving assembly /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/Mono.Android.dll
resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.Core.dll
Unknown return type java.util.Vector<com.paypal.android.MEP.MEPReceiverAmounts> found in method AdjustAmountsAdvanced in type Com.Paypal.Android.MEP.IPaymentAdjuster
Invalid parameter type com.paypal.android.MEP.PaymentAdjuster found in method Checkout in type Com.Paypal.Android.MEP.PayPal
Invalid parameter type com.paypal.android.MEP.PaymentAdjuster found in method Checkout in type Com.Paypal.Android.MEP.PayPal
Invalid parameter type com.paypal.android.MEP.PaymentAdjuster found in method Checkout in type Com.Paypal.Android.MEP.PayPal
Invalid parameter type com.paypal.android.MEP.PaymentAdjuster found in method Checkout in type Com.Paypal.Android.MEP.PayPal
Unknown return type java.util.Hashtable<java.lang.String, java.lang.Object> found in method G in type Com.Paypal.Android.A.B
Unknown return type org.apache.http.impl.client.DefaultHttpClient found in method H in type Com.Paypal.Android.A.B
Unknown return type java.util.Vector<com.paypal.android.MEP.MEPReceiverAmounts> found in method AdjustAmountsAdvanced in type Com.Paypal.Android.MEP.PayPalActivity
Class Com.Paypal.Android.A.C has unknown base type org.apache.http.conn.ssl.SSLSocketFactory
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method A in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method A in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method A in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.Document found in method A in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.Document found in method A in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.NodeList found in method A in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method B in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method B in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.Document found in method B in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method C in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method C in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.Document found in method C in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method D in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method D in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method E in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method F in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method F in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method G in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method G in type Com.Paypal.Android.A.M
Unknown parameter type java.util.Hashtable<java.lang.String, java.lang.Object> found in method H in type Com.Paypal.Android.A.M
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.A
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.F
unexpected field type java.util.Vector
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.C
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.G
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.H
Unknown parameter type org.w3c.dom.Element found in method A in type Com.Paypal.Android.A.A.K

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDroid.Generation.GenBase.GetAllDerivedInterfaces (System.Collections.Generic.List`1 ifaces) [0x00000] in <filename unknown>:0 
  at MonoDroid.Generation.GenBase.GetAllDerivedInterfaces () [0x00000] in <filename unknown>:0 
  at MonoDroid.Generation.GenBase.FillProperties () [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDroid.Generation.GenBase.GetAllDerivedInterfaces (System.Collections.Generic.List`1 ifaces) [0x00000] in <filename unknown>:0 
  at MonoDroid.Generation.GenBase.GetAllDerivedInterfaces () [0x00000] in <filename unknown>:0 
  at MonoDroid.Generation.GenBase.FillProperties () [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Binder.CodeGenerator.Run (Xamarin.Android.Binder.CodeGeneratorOptions options) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Binder.CodeGenerator.Main (System.String[] args) [0x00000] in <filename unknown>:0 
 (PayPal)
Comment 1 Atsushi Eno 2012-06-28 03:24:45 UTC
> Error: Tool exited with code: 1. Output: Type com.paypal.android.MEP.a.a: FxDG
> naming violation: Type name 'a' matches namespace part 'A'.

The library you are trying to bind is likely obfuscated and you have to exclude those unbindable parts of the library by Metadata.xml.

If you removed all those types and still have issues, reopen it. (->NEEDINFO)
Comment 2 Atsushi Eno 2012-07-03 12:25:54 UTC
Use the following Metadata.xml and it builds.

<metadata>
  <!-- remove obfuscated packages -->
  <remove-node path="/api/package[@name='com.paypal.android.MEP.a']" />
  <remove-node path="/api/package[@name='com.paypal.android.MEP.b']" />
  <remove-node path="/api/package[@name='com.paypal.android.a']" />
  <remove-node path="/api/package[@name='com.paypal.android.a.a']" />
  <remove-node path="/api/package[@name='com.paypal.android.b']" />
  <remove-node path="/api/package[@name='com.paypal.android.c']" />

  <!-- remove obfuscated and blocking classes -->
  <remove-node path="/api/package[@name='com.paypal.android.MEP']/class[@name='a']" />
  <remove-node path="/api/package[@name='com.paypal.android.MEP']/class[@name='b']" />
  <remove-node path="/api/package[@name='com.paypal.android.MEP']/class[@name='PayPal.a']" />
  <remove-node path="/api/package[@name='com.paypal.android.MEP']/class[@name='PayPal.b']" />

  <attr path="/api/package[@name='com.paypal.android.MEP']/class[@name='PayPalActivity']/method[@name='onKeyDown']/parameter" name="type">Android.Views.Keycode</attr>
</metadata>