Reputation: 612
I get that exception in my Xamarin.Forms Android App (all latest SDK) on a Samsung Galaxy mobile phone on app launch.
2-15 01:49:56.431 29826 29826 D AndroidRuntime: Shutting down VM 02-15 01:49:56.431 29826 29826 E AndroidRuntime: FATAL EXCEPTION: main 02-15 01:49:56.431 29826 29826 E AndroidRuntime: Process: com.rolsped.stage.TruckerApp, PID: 29826 02-15 01:49:56.431 29826 29826 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform! 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6770) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:6362) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6302) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.access$1800(ActivityThread.java:222) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7229) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform! 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:38) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6767) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: ... 10 more 02-15 01:49:56.431 29826 29826 E AndroidRuntime: Caused by: android.content.pm.PackageManager$NameNotFoundException: Xamarin.Android.Platform 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:368) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:32) 02-15 01:49:56.431 29826 29826 E AndroidRuntime: ... 11 more
I get it only on that type of a mobile phone.
All I found until now doesn't solve that issue including setting the AndroidUseLatestPlatformSdk
to false
what I found here.
Hope someone can help me out.
Thanks
Eric
Upvotes: 7
Views: 4233
Reputation: 9703
I was having this issue from a build in Azure DevOps but not locally, it wasn't picking up the fact I had set this in the project.
I had to manually set EmbedAssembliesIntoApk
and AndroidUseSharedRuntime
in the Android build step, this is the yaml:
- task: XamarinAndroid@1
displayName: 'Build Android App'
inputs:
projectFile: '$(AndroidProject)'
configuration: '$(BuildConfiguration)'
outputDirectory: '$(OutputDirectory)'
msbuildArchitectureOption: x64
msbuildArguments: '/verbosity:detailed /p:TreatWarningsAsErrors="true" /p:EmbedAssembliesIntoApk="true" /p:AndroidUseSharedRuntime="false"'
Upvotes: 0
Reputation: 2151
The mentioned Use Shared Runtime option disabling is definitely the solution to allow app deployment. Though that option should allow faster deployments during the development.
There should be a way to use the Shared Runtime and run apps successfuly.
In my case I deployed a fresh app with minSdk=16
on a device with API 19.
So I found "Mono.Android.Platform.ApiLevel_19-1.apk" in the /data/app/
folder.
The compiler Android platform was of API 28.
But the exception says:
Unable to find application Mono.Android.Platform.ApiLevel_25 or Xamarin.Android.Platform
So it's a complete mess.
Maybe on a device with API 25 it would work.
Edit:
Finally, what worked for me.
Downloaded "platform-25_r03.zip" from Android SDK, unpacked it to "platforms" folder, renamed to "android-25". Then created new project, Run.
(Oh, and previously removed Mono apps):
adb uninstall Mono.Android.DebugRuntime
adb uninstall Mono.Android.Platform.ApiLevel_19
It installed "Mono.Android.Platform.ApiLevel_25.apk".
Dev parameters for this case:
And in the Xamarin Studio -> Help -> About it says:
Supported Android versions:
4.1 (API level 16)
4.4 (API level 19)
7.1 (API level 25)
After adding API 25 platform folder.
Upvotes: 0
Reputation: 6780
Yes as mentioned in the answer above:
Disabling Use Shared Runtime from Project -> Options -> Android Options
should work in most cases, and that is indeed the first thing to try. But if that doesn't work, you may also try to add to the list of supported architectures from Android Project Properties -> Advanced as shown in the images below.
Hope this helps.
Upvotes: 2
Reputation: 612
Disabling Use Shared Runtime
from Project ->Options->Android Options
solved it.
Upvotes: 20