Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Tested with the monodroid facebook sample (https://github.com/xamarin/monodroid-samples/tree/master/Facebook)
Build the latest Facebook SDK (https://github.com/facebook/facebook-android-sdk)
Add it to the monodroid facebook sample (replace com.android.facebook.zip with newly built SDK)
Try to build.
You will get build errors:
/Users/brett/code/monodroid-samples/Facebook/Mono.Facebook/obj/Debug/generated/src/Com.Facebook.Model.PropertyNameAttribute.cs(18,18): Error CS0234: The type or namespace name `Runtime' does not exist in the namespace `Com.Facebook.Android'. Are you missing an assembly reference? (CS0234) (Mono.Facebook)
Adding the Mono.Android.Support.v4 dll as a reference to the Mono.Facebook project causes different errors, specifically a name collision in generated code:
/Users/brett/code/monodroid-samples/Facebook/Mono.Facebook/obj/Debug/generated/src/Com.Facebook.Session.cs(39,39): Error CS0102: The type `Com.Facebook.Session.OpenRequest' already contains a definition for `id_setPermissions_Ljava_util_List_' (CS0102) (Mono.Facebook)
Furthermore, the monodroid facebook sample uses com.facebook.android which is a deprecated package.
I found that the latest Facebook SDK uses types from org.json and java.lang.reflect a lot and they are not supported in MfA, likely resulted in this problem. Needs to sort out what exactly causes it.
That issue with Com.Facebook.Session.OpenRequest seems to occur because both OpenRequest and its parent class AuthorizationRequest define a method:
For some reason, when the Java Binding Library project is generating the stub classes, it puts both of those methods onto the Com.Facebook.Session.OpenRequest class ... and then adds that id_SetPermissions_Ljava_util_List_ static IntPtr as the handle for the native method. Hence, the redefinition since the signatures are the same.
There's no way around that with transforms, however, since the method is in the wrong class. I did go back to the source in Eclipse and changed the base class method name there - which got round that problem. However ...
The earlier error that Brett mentions still exists. Again, it's look like a code generation problem, since the annotation in Com.Facebook.Model.PropertyNameAttribute looks like:
In this case, the Android name is resolved to the wrong namespace - Com.Facebook.Android (I think). Manually making that global::Android.Runtime..... does let it compile, although you have to make that change in the generated code after every rebuild :-(
With all that, the Java Binding Library project compiles ...
Actually using the output in another project is something else again, however, which I haven't got to the bottom of yet. I may have to back off to the (deprecated) sample project code for the time being.
I forgot to mention: annotation-mapped attributes will be prefixed "global::" in the next release, so the issue will be gone, Adrian.
This issue is fixed in the latest "xamarin 2.0" release. I updated monodroid-samples as well.