[BUG] Decompile/compile with resources off (-r flag) makes app crash on startup
See original GitHub issueInformation
- Apktool Version (
apktool -version
) - 2.4.1 - Operating System (Mac, Linux, Windows) - Linux
- APK From? (Playstore, ROM, Other) - Playstore
Stacktrace/Logcat
06-26 22:06:43.685 19186 19186 W PackageManager: Failure retrieving xml 0x7f150002 in package com.instagram.android
06-26 22:06:43.685 19186 19186 W PackageManager: android.content.res.Resources$NotFoundException: File r/b0y.xml from xml type xml resource ID #0x7f150002
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1149)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.Resources.loadXmlResourceParser(Resources.java:2150)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.Resources.getXml(Resources.java:1206)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ApplicationPackageManager.getXml(ApplicationPackageManager.java:2193)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.pm.PackageItemInfo.loadXmlMetaData(PackageItemInfo.java:393)
06-26 22:06:43.685 19186 19186 W PackageManager: at androidx.core.content.FileProvider.A00(:33)
06-26 22:06:43.685 19186 19186 W PackageManager: at androidx.core.content.FileProvider.attachInfo(:12)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread.installProvider(ActivityThread.java:6578)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread.-wrap1(Unknown Source:0)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.os.Handler.dispatchMessage(Handler.java:105)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.os.Looper.loop(Looper.java:164)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.app.ActivityThread.main(ActivityThread.java:6944)
06-26 22:06:43.685 19186 19186 W PackageManager: at java.lang.reflect.Method.invoke(Native Method)
06-26 22:06:43.685 19186 19186 W PackageManager: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
06-26 22:06:43.685 19186 19186 W PackageManager: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
06-26 22:06:43.685 19186 19186 W PackageManager: Caused by: java.io.FileNotFoundException: r/b0y.xml
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.AssetManager.openXmlAssetNative(Native Method)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:560)
06-26 22:06:43.685 19186 19186 W PackageManager: at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1134)
06-26 22:06:43.685 19186 19186 W PackageManager: ... 17 more
Steps to Reproduce
apktool decode -f -r -o temp/ instagram.apk
apktool build temp/ -o new.apk
APK
I also tested with latest version of apktool, doesn’t work either. But when I remove the -r
flag, it works (after changing some configs). Isn’t the point of having the -r
to avoid such error of missing resources? What steps should I take to try to manually fix it?
Thank you.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Android App suddenly crashes when compiling in Release ...
My App was working fine when build to release mode, and both when downloading from Google play store or from a Android device...
Read more >AAPT2 - Android Developers
Although you can use this flag to compile multiple resource files with one command, it disables the benefits of incremental compilation.
Read more >Automatic resource shrinking causes app to crash [37010152]
Application should start normally. OBSERVED RESULTS: Application crashes with following stacktrace: android.content.res.
Read more >Bug listing with status UNCONFIRMED as at 2022/12/12 00 ...
Compiler wrapper to enable security hardening flags" status:UNCONFIRMED ... Bug:526154 - "www-apps/opencart-2.0 - a turn-key ready "out of the box" shopping ...
Read more >LogCat message: The Google Play services resources were ...
Try cleaning all of the projects in your workspace (under Project > Clean ). I've noticed that this sometimes fixes R.java/resource issues. –...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lucaswxp Can you explain this --pause flag. Didn’t find anything realted to this flag in the repo.
I am also having some resource errors with apps when decompiled without -r.
I have the same problem with most apps. Compiled app crashes with resource related errors such as this. Some apps crash with -r flag, some without -r flag, some crash with both.
Test app: https://drive.google.com/file/d/1Y0CZy0l626ZYKT6lydUygQrjTIsObnJ9/view?usp=sharing