This non-standard behavior is rare, but quite annoying.
The solution is simple - replacing the reference value with the actual value from integers.xml, just like Apktool already does for versionName.
This non-standard behavior is rare, but quite annoying.
The solution is simple - replacing the reference value with the actual value from integers.xml, just like Apktool already does for versionName.
This Apktool issue has existed for a long time and is especially prevalent with ROMs with multiple frameworks.
The issue happens because Apktool treats reference values inside XMLs (like layouts) as raw text values, and doesn't resolve them during decompile time. This causes some values to be misformed, but more importantly, this causes values referencing to secondary frameworks to not be resolved with their source frameworks, which also means the framework ID won't be added to usesFramework.ids in apktool.yml, and that breaks recompiling.
The interesting thing is that reference values are actually being resolved when they are located in value resources, like styles, thus presenting an inconsistent behavior.
This simple mod eliminates the "rawValue" for reference values, and that forces the "value" (resource ID) to resolve against the respective frameworks, fixing misformed values in the process.
BEFORE:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
Some comparisons before and after the fix:
https://i.imgur.com/2gTllT0.pnghttps://i.imgur.com/KzJUeQt.png
AFTER:
I: Using Apktool 2.4.0-896569-SNAPSHOT on Notes.apk
I: Loading resource table...
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (miui.system), pkgId: 18
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: bin\framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Loading resource table from file: bin\framework\16.apk
I: Decoding Shared Library (androidhwext), pkgId: 15
I: Loading resource table from file: bin\framework\18.apk
I: Decoding Shared Library (miui), pkgId: 16
I: Decoding Shared Library (android.miui), pkgId: 17
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
Somehow Google manages to compile MiuiSystemUI.apk (and a few other APKs I encountered) with a misformed pip_dismiss_scrim.9.png.
Either way, every time I encountered such 9.patch images, the missing lines always indicated a single full div or padding.
Apktool already fills missing padding lines, now it can also fill missing divs.
Starting with the version 28.0.3 of the Android SDK build tools,
the internal ids of the items of an array bag seems to have changed.
Because of those changes, array resources were no longer decoded correctly.
They were decoded as style resources.
Instead of using the id of the first item within a resource bag,
the name of the res type spec is now used to choose the correct
resource bag value to create.
Note: a list of "legal names" for resource types can be found in the source code of aapt2.
build: force windows onto the bash environment
build: update permission (+x) of clean-test file
build: "bat" instead of "exe" extension
build: attempt to support long-path names on windows
build: another attempt at long filepaths on windows
build: force +x on scripts prior to execution
build: exit with return code of last command
build: dump out current path
build: dump out current path - part 2
fix: remove 5 chars from path to drop down from 260 windows max path
build: correct gradlew.bat path and remove unneeded lines
fix: remove long path global configuration
fix: restore PATH setting for windows env
build: PATH resets between scripts, fix for windows
When I am decompiling an apk, I got this exception:
Exception in thread "main" java.lang.NullPointerException
at brut.androlib.res.data.ResResSpec.<init>(ResResSpec.java:42)
- Add a --no-crunch/-nc flag to apktool which gets passed through to aapt
- This allows apktool to make a byte-for-byte copy of resource files
- refs: #1232
- refs: #244
- Regular expressions are not the way to fix this. Too many situations
in smali where patterns won't work. Correct fix would be to hook dexlib
- split from aapt1/aapt2 (those that do building)
- tests that just test decode (no aapt) split
- categories for androlib/encdoers/util for various others