Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary
Include stacktrace here
No error building apk but App doesn't get registered to system , found some documentation
https://developer.android.com/about/versions/11/behavior-changes-11
apktoolIf this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)
If this APK can be freely shared, please upload/attach a link to it.
apktool d, apktool b without changing anything? - Yesjust do zipalign -f -p 4 input.apk output.apk after you compile the apk.
We have an existing ticket for R and zipaligning to align bytes is preferred.
Using zipalign does not help, since:
resources.arsc of installed APKs to be stored uncompressed AND aligned on a 4-byte boundary
But apktool builds a compressed apk, so it fails anyway.
EDIT: No, sorry.
The apk i was trying to decompile had a compressed resources.arsc , so apktool did not add "arsc" to the donotcompress section of apktool.yml. After editing, everything is fine. Maybe there is a change to make in the code: if the app targets r+, automatically add arsc to the donotcompress option.
Hi @ElDavoo
Could you please give more information on what you've edited? and how you fixed it?
I've just removed line - resources.arsc from apktool.yml and tried, but unfortunately, it's not working.
Thanks in advance!!
Hi,
The apk i've edited
Since it was not installing the error above, i wanted to use apktool to extract and recompress the apk, leaving resources.arsc uncompressed. However, since resources.arsc was compressed in the original apk, it was not automatically added to the doNotCompress option of apktool.yml . For this reason, when I recompressed the apk unzip and zipalign showed that the file was compressed. Adding "arsc" to the doNotCompress option of apktool.yml solved the problem because the apk was rebuild and resources.arsc was not compressed, allowing me to install the application (which crashes anyway but it's a problem of the app).For this reason, I propose that when the cmdline "-api 30" is written, apktool systematically adds resources.arsc to the doNotCompress option of apktool.yml. This way, the error will never appear.
Tell me if there is anything unclear.;
In short: apktool only behaves incorrectly only with apks that are already wrong.
Most helpful comment
just do
zipalign -f -p 4 input.apk output.apkafter you compile the apk.