You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xamarin构建应用在客户远程设备崩溃问题求助

Fix for Xamarin Android Crash: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform

First, let's recap the crash context: You've enabled unknown source installs, the app runs fine on your dev/non-dev devices, but crashes immediately on a client's remote device with the following stack trace:

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!
E/AndroidRuntime( 8048):  at android.app.ActivityThread.installProvider(ActivityThread.java:5571)
E/AndroidRuntime( 8048):     at android.app.ActivityThread.installContentProviders(ActivityThread.java:5163)
E/AndroidRuntime( 8048):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5103)
E/AndroidRuntime( 8048):   at android.app.ActivityThread.access$1600(ActivityThread.java:177)
E/AndroidRuntime( 8048):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1510)
E/AndroidRuntime( 8048):     at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 8048):     at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime( 8048):  at android.app.ActivityThread.main(ActivityThread.java:5951)
E/AndroidRuntime( 8048):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8048):   at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 8048):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
E/AndroidRuntime( 8048):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
E/AndroidRuntime( 8048): Caused by: java.lang.RuntimeException: Unable to find application Mono.Android.Platform.ApiLevel_24 or Xamarin.Android.Platform!
E/AndroidRuntime( 8048):   at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:38)
E/AndroidRuntime( 8048):     at android.app.ActivityThread.installProvider(ActivityThread.java:5568)
E/AndroidRuntime( 8048):     ... 11 more
E/AndroidRuntime( 8048): Caused by: android.content.pm.PackageManager$NameNotFoundException: Xamarin.Android.Platform
E/AndroidRuntime( 8048):    at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:305)
E/AndroidRuntime( 8048):     at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:32)
E/AndroidRuntime( 8048):     ... 12 more

This error almost always ties to how the app is packaged (your dev devices have Xamarin's runtime dependencies pre-installed, but client devices don't). Here are the step-by-step fixes you should try:

  • Switch to Release Mode with Independent Packaging
    Your dev environment uses the Xamarin Shared Runtime to speed up deployments, but client devices don't have this runtime installed. In Visual Studio:

    1. Switch your build configuration to Release.
    2. Right-click your Android project → Properties → Android Options.
    3. Under the Packaging tab, uncheck Use Shared Runtime (this ensures all Mono/Xamarin dependencies are bundled directly into your APK).
    4. For better compatibility, enable Generate one package (.apk) if targeting multiple architectures, or select the specific architecture matching the client's device.
  • Verify API Level Consistency
    The log mentions ApiLevel_24, so double-check:

    1. In Android project properties, ensure Target Framework, Compile Using Android Version, and Minimum Android Version are set consistently (e.g., if targeting API 24, make sure the min version isn't higher than the client's device Android version).
    2. Confirm you haven't accidentally mixed API levels in your project references.
  • Clean and Rebuild Your Project
    Corrupted build artifacts often cause this issue:

    1. Go to Build → Clean Solution.
    2. Manually delete the bin and obj folders from your Android project directory.
    3. Rebuild the solution and re-package the APK.
  • Disable Fast Deployment
    Fast Deployment is a dev-only feature that skips bundling some files. Disable it in Release mode:

    1. In Android project properties → Android Options → Debugging.
    2. Uncheck Enable Fast Deployment.
  • Validate APK Integrity
    Ensure the APK you sent to the client isn't corrupted:

    1. Re-sign the APK with your release keystore (if you haven't already).
    2. Have the client re-download/receive the APK and reinstall it, making sure they've fully uninstalled any previous versions first.
  • Check Client Device Android Version
    If the client's device is running an Android version lower than API 24, adjust your project's Minimum Android Version to match (or lower) that version, then rebuild and re-deploy.

These steps should resolve the missing runtime provider issue in most cases.

内容的提问来源于stack exchange,提问作者Sai Kishore

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:16:14