Android app crash with ResourceNotFoundException

Viewed 8464

I recently checked for my GP crash logs and I am getting this callstack very frequently. Could you please help me.

A few things:

  • The failed to add asset path sometimes shows /data/app/com.xxx.xxx.xxx-x/base.apk and sometimes /mnt/asec/com.xxx.xxx.xxx-x/base.apk.
  • The device android versions (where it is reported) varies from Android 4.4. to Android 7.0
  • In the GP console, Android version shows Android 7.0 for all crashes but the device list has devices with Android version 6.0, 5.0, etc which is unclear.
  • I have two apps with shared user Id, say with package names P1, P2. For P1, the failed to add asset path sometimes shows /data/app/P2 and sometimes /mnt/asec/P1. Isn't this incorrect and what could cause this?

Call stacks:

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)

Another crash:

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)
3 Answers

Please check if the App has external drive permissions. In my case this issue triggered when ADB installed the App to the device which is screen locked, the same test has passed when the device is awake, so even though permissions available to this App

I have this error for com.android.billingclient:billing. Problem is "there is no account in the device", for example a new device or reset to vendor settings.

So just add an account in global settings.

I just installed the app again (without uninstalling old app) and it worked for me.

Related