Skip to content

Instantly share code, notes, and snippets.

@dbeattie71
Forked from brendanzagaeski/gist:9378181
Created February 11, 2016 21:16
Show Gist options
  • Select an option

  • Save dbeattie71/6b99cf59702ebaad177b to your computer and use it in GitHub Desktop.

Select an option

Save dbeattie71/6b99cf59702ebaad177b to your computer and use it in GitHub Desktop.
Xamarin.Android.Support vs. Mono.Android.Support: use Xamarin.Android.Support
Recommendation: use the Xamarin.Android.Support.* components instead of the Mono.Android.Support.* libraries
As discussed on [1], the Xamarin.Android.Support.* components are now recommended over the Mono.Android.Support.* libraries. One reason for this is that the Xamarin.Android.Support components can be updated more frequently to keep pace with new releases from Google. Eventually, the Mono.Android.Support will be removed from Xamarin.Android. All new code should use the Xamarin.Android.Support libraries.
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=15205
## Xamarin.Android.Support components in binding projects
At the moment, there's a limitation with using Xamarin.Android.Support components in Xamarin.Android Java binding projects. Specifically, the bindings projects do not yet "know" how to automatically reference the `.jar` files used by the components. This leads to error messages like:
> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets: Error: Tool exited with code: 1. Output: java.lang.NoClassDefFoundError: android/support/v4/app/Fragment
> warning J2X9001: Couldn't load class com/google/android/m4b/maps/SupportMapFragment : java.lang.NoClassDefFoundError: android/support/v4/app/Fragment
> warning J2XA006: missing class error was raised while reflecting com.google.android.m4b.maps.SupportMapFragment$a : android/support/v4/app/Fragment
### Workaround
To work around this limitation, add the appropriate Android support `.jar` file to the binding project, and set its Build Action to "ReferenceJar". For example, for Xamarin.Android.Support.v4 (the "Android Support Library v4" component), add the following file from the Android SDK folder:
extras/android/support/v4/android-support-v4.jar
Note that you do _not_ need to set the build action to EmbeddedReferenceJar. The app project that uses the binding project will need to reference the Xamarin.Android.Support component, and Xamarin.Android _app_ projects _do_ understand how to automatically reference the support `.jar` files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment