question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Decompile/compile with resources off (-r flag) makes app crash on startup

See original GitHub issue

Information

  1. Apktool Version (apktool -version) - 2.4.1
  2. Operating System (Mac, Linux, Windows) - Linux
  3. 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

  1. apktool decode -f -r -o temp/ instagram.apk
  2. apktool 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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sriteja777commented, Nov 19, 2021

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.

0reactions
timea-techgirlcommented, Aug 25, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found