Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find application Mono.Android.Platform.ApiLevel_23 or Xamarin.Android.Platform

I have a Xamarin.Android application that is being built through a build server. The application is targeting API Level 23 and Min Android Version 4.1 (API 16). During debug the application works fine, but when the build server compiles the application, packages it, signs, and aligns it, it crashes on load with the error:

Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_23 or Xamarin.Android.Platform

Most phones result in an immediate crash with the error mentioned above, but a handful of devices work fine. The only thing those devices have in common is they were used to deploy the application during development. This leads me to believe they have the shared run time installed and hence why it doesn't fail. The build server has the latest Xamarin.Android (just like the dev machines), latest Java, latest JDK, and latest Android libraries (per the SDK Manager). The configuration being built doesn't use the shared runtime, it is not linking (although I also tried it with linking SDK assemblies only), and it only supports armeabi-7va ABI.

What am I doing wrong?

like image 974
Jonas Stawski Avatar asked Oct 31 '22 04:10

Jonas Stawski


1 Answers

I have finally found the problem which seems to be a bug with Xamarin (or Mono?). We have AndroidManifest.xml and AndroidManifestAlpha.xml. During the build we specify /p:AndroidManifest=Properties/AndroidManifestAlpha.xml to the MSBUILD arguments, but the compilation adds all the activity, services, and mono information to the AndroidManifest.xml file only. The build eventually uses the specified AndroidManifestAlpha.xml file and compiles the APK without the mono runtime; resulting in the error mentioned above.

like image 98
Jonas Stawski Avatar answered Nov 22 '22 06:11

Jonas Stawski