Android App Bundle检查缺少的拆分会导致“ RuntimeException:程序包管理器已死”

时间:2019-05-30 11:34:42

标签: android google-play android-package-managers android-app-bundle android-application-class

我遵循this guide将检查集成到我的应用程序中,以防止在使用Android应用程序捆绑包时(由于缺少资源)在运行时崩溃。

在超级调用之前,我在onCreate()方法中的应用程序类中添加了以下代码:

if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
    // Skip app initialization.
    return
}

这在我自己的测试设备上没有问题。但是,如果我将Android App Bundle上传到Google Play,则预发布报告中的某些设备会出现此异常:

FATAL EXCEPTION: main
Process: com.example, PID: 25603
java.lang.RuntimeException: Unable to create application com.example.App: java.lang.RuntimeException: Package manager has died
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4858)
    at android.app.ActivityThread.access$1600(ActivityThread.java:163)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1423)
    at android.os.Handler.dispatchMessage(Handler.java:102)com.example
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5585)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.RuntimeException: Package manager has died
    at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:136)
    at Cfa.a(SourceFile)
    at com.example.App.onCreate(SourceFile:17)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4855)
    ... 8 more
Caused by: android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(Binder.java:503)
    at android.content.pm.IPackageManager$Stub$Proxy.getPackageInfo(IPackageManager.java:2215)
    at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:131)
    ... 12 more

经过一些搜索,我发现此问题与Play Core库无关,而与Android包管理器有关。 Play Core库似乎使用包管理器来检查是否缺少拆分。我不知道该如何解决此问题,因为该异常不在我的代码内,因此,我将不胜感激地找到解决方案。

0 个答案:

没有答案