Android app crash with ResourceNotFoundException
Asked Answered
T

2

12

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)
Thole answered 17/5, 2017 at 5:17 Comment(5)
what's in your assets? Do post your manifest. Is it a specific device that is throwing this exception?Opsis
Unable to create BackupAgent giving a hint that user might be trying to backup your app data (your manifest might have allowBackup = true and also are you allowing your app to be installed on external storage?Opsis
Its seen across multiple devices like Samsung Galaxy 6,7, Xperia, etc. Allowbackup is false for main app but true for some sub-modules though in the main app manifest, tools:replace overrides allowBackup. So its makes it false.Thole
Yes it can be installed in external storage.Thole
I'm stymied looking at "E/ResourcesManager( 2375): failed to add asset path /data/app/<myprog>-sHDd-VYemA3rocflBxq8QA==/base.apk" where sHDd-VYem... is the path to +a recently uninstalled+ <myprog>.apk! No external storage, no backups, no nothing. And the manifest is as clear as a teardrop.Evie
T
0

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

Teutonism answered 15/11, 2018 at 10:0 Comment(0)
T
0

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.

Thievery answered 13/1, 2022 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.