Skip to content

Conversation

@TechnoIndian
Copy link

Fixed: Missing Attributes / namespace / Format etc.

Info

OS: Termux ( Android )

used aapt2 Binary - https://github.com/Maximoff/binaries/blob/main/bin/arm64-v8a/sdk35/aapt2

aapt2 version: Android Asset Packaging Tool (aapt) 2.19-R.20584df_1 (build by tilks 20241028)

Apktool version: apktool-v2.12.1-33-0df4f393-SNAPSHOT

APK INFO ( OBFUSCATE )

PACKAGE NAME - com.musixmatch.android.lyrify ( 8.1.4 ) ( Tested ✅ )

OR

PACKAGE NAME - com.orange.mobinilandme ( Tested ✅ )

OR

PACKAGE NAME - com.kaliranaapp.edu ( Tested ✅ )

I: Using Apktool v2.12.1-33-0df4f393-SNAPSHOT on Musixmatch_8.1.4.apk with 8 threads
I: Copying raw classes.dex file...
I: Copying raw classes2.dex file...
I: Copying raw classes3.dex file...
I: Copying raw classes4.dex file...
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: /data/data/com.termux/files/home/.local/share/apktool/framework/1.apk
I: Decoding values */* XMLs...
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f04046d, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f14054f, name=null, type=RESOURCE}
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f04046e, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f140551, name=null, type=RESOURCE}
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f04046f, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f140552, name=null, type=RESOURCE}
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f040470, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f140555, name=null, type=RESOURCE}
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f040471, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f140554, name=null, type=RESOURCE}
W: null style reference: key=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f040474, name=null, type=RESOURCE}, value=ResReference{pkg=ResPackage{id=0x7f, name=com.musixmatch.android.lyrify}, id=0x7f140559, name=null, type=RESOURCE}
....
I: Decoding AndroidManifest.xml with resources...
I: Copying original files...
I: Copying assets...
I: Copying lib...
I: Copying unknown files...

Successfully Decompile with some warning, But error in Recompile

Recompile

~ $ java -jar apktool-v2.12.1-33-0df4f393-SNAPSHOT.jar b Musixmatch_8.1.4 --aapt ./aapt2
I: Using Apktool v2.12.1-33-0df4f393-SNAPSHOT on Musixmatch_8.1.4.apk with 8 threads
I: Checking whether resources have changed...
I: Building resources with aapt2...
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130771980.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130771980.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772007.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772007.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772027.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772027.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772029.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772029.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772031.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772031.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772068.xml:2: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/anim/2130772068.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837504.xml:4: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837504.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837513.xml:4: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837513.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837516.xml:7: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837516.xml: error: file failed to compile.
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837517.xml:7: error: not well-formed (invalid token).
W: /data/data/com.termux/files/home/Musixmatch_8.1.4/res/animator/2130837517.xml: error: file failed to compile.
Exception in thread "main" brut.androlib.exceptions.AndrolibException: brut.common.BrutException: Execution failed (exit code = 1): [./aapt2, compile, --dir, /data/data/com.termux/files/home/Musixmatch_8.1.4/res, --legacy, -o, /data/data/com.termux/files/home/Musixmatch_8.1.4/build/resources.zip]
        at brut.androlib.res.AaptInvoker.invoke(SourceFile:89)
        at brut.androlib.ApkBuilder.buildResources(SourceFile:320)
        at brut.apktool.Main.main(SourceFile:95)
Caused by: brut.common.BrutException: Execution failed (exit code = 1): [./aapt2, compile, --dir, /data/data/com.termux/files/home/Musixmatch_8.1.4/res, --legacy, -o, /data/data/com.termux/files/home/Musixmatch_8.1.4/build/resources.zip]
        at brut.util.OS.exec(SourceFile:148)
        at brut.androlib.res.AaptInvoker.invoke(SourceFile:85)
        ... 2 more

IMG_20251205_121229

Conclusion

if OBF attribute is integer mean startwith digit then show error: not well-formed (invalid token). According to ChatGPT XML attribute names must not begin with a number (digit).

When we use the --res-resolve-mode dummy flag, we will need First commit. We will use this because aapt2 never accept attribute names that start with a digit.


First Change

Added prefix if type="attr" & name startwith a digit ( attr_id ) - commit - 9f3fd2d

IMG_20251205_121321


Second Change

IMG_20251208_122615

The second change that needs to be made is that currently, if isDummy is true in Apktool, adds the line <item type="attr" name="APKTOOL_DUMMY_0x7f04000e">@null</item> to attrs.xml. However, this line is written incorrectly, which is causing the error: W: /data/data/com.termux/files/home/M/res/values/styles.xml:4: error: resource attr/APKTOOL_DUMMY_0x7f040010 (aka com.musixmatch.android.lyrify:attr/APKTOOL_DUMMY_0x7f040010) not found. As you can see in the screenshot, the APKTOOL_DUMMY_0x7f040010 attribute is defined in attrs.xml, but the error still shows because it's written in the wrong format. These lines should be written like this: <attr name="APKTOOL_DUMMY_0x7f04000f">@null</attr>

fixed attr dummy entries commit - dd13dad

Screenshot_2025-12-08-22-48-09-03_5a36f6e0f8b96c8fbbd9efc54bb8de1e

@IgorEisberg
Copy link
Collaborator

IgorEisberg commented Dec 9, 2025

Already got resource name verification in the works, as well as the missing attributes and attribute items you discussed in your previous PR, via a more direct approach that doesn't involve hacky static collections and hacky XML post-processing.
As for the "attr_" or "id_" prefixes, we already have a standardized naming convention (always prefixed with "APKTOOL_"), anything else risks name conflicts caused by an obfuscator. If you don't like the names, you can post-process the XMLs after decompilation (simple batch sed operation).

@IgorEisberg
Copy link
Collaborator

You can give this PR a try: #4041

@IgorEisberg IgorEisberg closed this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants