Android应用程序因ResourceNotFoundException而崩溃

时间:2017-05-17 05:17:13

标签: android crash android-resources callstack

我最近检查了我的GP崩溃日志,我经常收到这个callstack。请你帮助我好吗。

一些事情:

  • failed to add asset path有时会显示/data/app/com.xxx.xxx.xxx-x/base.apk,有时显示/mnt/asec/com.xxx.xxx.xxx-x/base.apk
  • 设备Android版本(报告的地方)与Android 4.4不同。到Android 7.0
  • 在GP控制台中,Android version显示所有崩溃的Android 7.0,但设备列表包含Android version 6.0,5.0等设备,但不清楚。
  • 我有两个共享用户ID的应用,比如包名P1,P2。对于P1,failed to add asset path有时会显示/data/app/P2,有时会显示/mnt/asec/P1。这不正确吗?是什么导致这种情况?

调用堆栈:

java.lang.RuntimeException: Unable to create BackupAgent android.app.backup.FullBackupAgent: android.content.res.Resources$NotFoundException: failed to add asset path data/app/com.P2.xxx/base.apk
    at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3452)
    at android.app.ActivityThread.-wrap5(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1796)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6688)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.content.res.Resources$NotFoundException: failed to add asset path /data/app/com.P2.xxx/base.apk
    at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
    at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
    at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
    at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
    at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2068)
    at android.app.LoadedApk.getResources(LoadedApk.java:780)
    at android.app.ContextImpl.<init>(ContextImpl.java:2244)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2184)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2175)
    at android.app.ActivityThread.handleCreateBackupAgent(ActivityThread.java:3422)

另一次崩溃:

android.content.res.Resources$NotFoundException: failed to add asset path /mnt/asec/com.P1.xxx/base.apk
    at android.app.ResourcesManager.createAssetManager(ResourcesManager.java:281)
    at android.app.ResourcesManager.createResourcesImpl(ResourcesManager.java:359)
    at android.app.ResourcesManager.getOrCreateResources(ResourcesManager.java:638)
    at android.app.ResourcesManager.getResources(ResourcesManager.java:730)
    at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:2052)
    at android.app.LoadedApk.getResources(LoadedApk.java:787)
    at android.app.ContextImpl.<init>(ContextImpl.java:2266)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2210)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2196)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5861)
    at android.app.ActivityThread.-wrap3(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6776)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)

2 个答案:

答案 0 :(得分:0)

请检查该应用程序是否具有外部驱动器权限。 在我的情况下,当ADB将应用程序安装到屏幕锁定的设备时触发了此问题,当设备唤醒时,通过了相同的测试,因此即使该应用程序具有可用权限

答案 1 :(得分:0)

我刚刚重新安装了该应用程序(没有卸载旧应用程序),它对我有用。