Apktool
Apktool copied to clipboard
[BUG] Decompile/compile with resources off (-r flag) makes app crash on startup
Information
- 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.apkapktool build temp/ -o new.apk
APK
https://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-192-0-0-35-123-release/
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.
Can you confirm what I'm rephrasing is correct?
You have a working bootable modified application when you apktool d/b without -r. However, when you introduce -r and do apktool b/d - the application fails with the stacktrace above
That is correct. When I remove the -r it kinda works, at least the app boots.
Em ter., 29 de jun. de 2021 06:51, Connor Tumbleson < @.***> escreveu:
Can you confirm what I'm rephrasing is correct?
You have a working bootable modified application when you apktool d/b without -r. However, when you introduce -r and do apktool b/d - the application fails with the stacktrace above
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iBotPeaches/Apktool/issues/2598#issuecomment-870489275, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAB4WQLLGT4LVPXZ7SPSDTVGQSTANCNFSM47L4AQYQ .
Just to make it clear, when I remove -r I get some resources errors that I can fix with --pause flag, thats fine, the app boots normally.
But with -r flag I dont get any compilation error, tho the app doesnt even boot and prints the stacktrace above.
Em ter., 29 de jun. de 2021 06:51, Connor Tumbleson < @.***> escreveu:
Can you confirm what I'm rephrasing is correct?
You have a working bootable modified application when you apktool d/b without -r. However, when you introduce -r and do apktool b/d - the application fails with the stacktrace above
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iBotPeaches/Apktool/issues/2598#issuecomment-870489275, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAB4WQLLGT4LVPXZ7SPSDTVGQSTANCNFSM47L4AQYQ .
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
can fix with --pause flag
@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.