Clients often want their website available in the app store, mostly just for app store presence. I got asked to do app wrapping at work a while ago, because the client purchased a tool that did not have a native app available, only a mob...
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets : error : trouble writing output: Too many field references: 74105; max is 65536.
My app itself was only consuming 2500 methods of the total. So the rest was added through NuGet packages. The biggest method consumers were the Android support libraries (40503 methods), Google for Analytics (19930 methods) and Firebase for notifications (7258 methods).
You use ProGuard to remove unused classes, fields and methods. So it can be used to work around the 64k limit. It essentially shrinks your app.
You can enable ProGuard at the project settings:
There is a quirk though: if you enable it and build again, you are most likely to run into this exception:
java.io.IOException: Can’t read [/Library/Frameworks/Xamarin.Android.framework/Versions/7.2.0-7/lib/xbuild-frameworks/MonoAndroid/v7.0/mono.android.jar] (Can’t process class [android/app/ActivityTracker.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))
Update: as mentioned in the comments, updating ProGuard is no longer required since Xamarin.Android v7.3 was released as part of the Xamarin release 15.2. It now bundles its own up-to-date copy of ProGuard (v5.3.2). Xamarin.Android v7.3 has been released as a stable on May 10th 2017.
This is caused by Xamarin.Android v7.0 (see the release notes), which requires JDK 1.8 if you target Android API 24+. So, the fix is to update ProGuard to the latest version on your build machine.
You can find ProGuard at the Android SDK location. You can find the SDK location in Xamarin Studio under Preferences > Projects > SDK Locations > Android. On my MacOS environment, the SDK is found here:
At that location, in the tools directory you can find proguard. Simply rename the proguard directory and replace it with the contents of the latest version of ProGuard that you can find on Sourceforge.
In case ProGuard doesn’t get you far enough, you can enable Multi-Dex in the project settings. It splits up the DEX-files, so this prevents them from going over the 64k limit.
You can enable Multi-Dex in the project settings, at the same location where you found ProGuard:
Keep in mind that you should first try to resolve the issue with ProGuard. Only enable Multi-Dex if you really need to. This is a warning that is also shown in the info icon in Xamarin Studio.