Decompiled APK with apktool has hex digits in AndroidManifest.xml

Issue

I tried to decompile the apk with apktool, modify it a bit, and re-build the apk.

Here is what I’ve tried:

  1. apktool d viber.apk
  2. Modified res/xml/android_backup_rules_api31.xml and res/xml/android_backup_rules.xml
  3. apktool b viber

… and step 3 cannot proceed because of the error below:

W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1076: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1077: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1078: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1083: error: '@2114846720' is incompatible with attribute resource (attr) reference.
W: error: failed processing manifest.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/brut_util_Jar_79656065772315295564857961138440605910.tmp, link, -o, /var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/APKTOOL17872764973844080976.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 33, --version-code, 651217, --version-name, 21.3.2.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, -e, /var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/APKTOOL13620375907382818829.tmp, -0, arsc, -I, /Users/<USERNAME>/Library/apktool/framework/1.apk, --manifest, /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml, /Users/<USERNAME>/Desktop/APK_RE/viber/build/resources.zip

… and I checked associated lines (i.e., 1076, 1077, 1078, 1083), and noticed that:

<activity android:exported="false" android:name="com.snap.camerakit.LegalPromptActivity" android:theme="@2114715648"/>
<activity android:exported="false" android:name="com.snap.camerakit.LegalPrePromptVariantGActivity" android:theme="@2114715648"/>
<activity android:exported="false" android:name="com.snap.camerakit.diagnostics.DiagnosticsExportActivity" android:theme="@2114715648"/>
...
<meta-data android:name="com.android.vending.splits" android:resource="@2114846720"/>

They all comes with this @+digits string. I thought this was some decoding error, so I checked the original APK with ClassyShark.jar, and they look like:

    <activity
        theme='@res/0x7E0C0000'
        name='com.snap.camerakit.LegalPromptActivity'
        exported='false'>
    </activity>
    <activity
        theme='@res/0x7E0C0000'
        name='com.snap.camerakit.LegalPrePromptVariantGActivity'
        exported='false'>
    </activity>
    <activity
        theme='@res/0x7E0C0000'
        name='com.snap.camerakit.diagnostics.DiagnosticsExportActivity'
        exported='false'>
    </activity>
...
    <meta-data
        name='com.android.vending.splits'
        resource='@res/0x7E0E0000'>
    </meta-data>

Why are these fields filled with hex digits? Is there any way I can fix them, or can I ignore them? (I don’t really care about these functions actually, and I only want to do some backup tests as you can see in step 2)

Solution

Robert’s answer in the comments worked:

  1. Remove associated attributes

  2. Build the apk

  3. Use some zip utility (e.g. 7z) to extract the original AndroidManifest.xml and replace the same file in re-built apk

Answered By – TaihouKai

Answer Checked By – David Marino (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *