Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] XAPK Base APK - Invalid Resource Decompilation | @null in XML Resources | Android 15 Target SDK #3806

Open
sipsuru opened this issue Feb 14, 2025 · 1 comment

Comments

@sipsuru
Copy link

sipsuru commented Feb 14, 2025

Information

  1. Apktool Version (apktool -version) - 2.11.0 | 2.11.0-7-f5c226b5-SNAPSHOT
  2. Operating System (Mac, Linux, Windows) - Windows
  3. APK From? (Playstore, ROM, Other) - Other [ApkCombo / ApkPure - XAPK]
  4. Java Version (java --version) - 23.0.1 | 2024-10-15

ADB Stacktrace/Logcat

adb: failed to finalize session
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1887994749.tmp/base.apk (at Binary XML file line #645): <meta-data> requires an android:value or android:resource attribute]

Steps to Reproduce

  1. Download xapk and extract apks inside.
  2. Decompile wp.wattpad.apk with apktool d wp.wattpad.apk
  3. Delete original wp.wattpad.apk
  4. Recompile without modifications with apktool b -o wp.wattpad.apk
  5. Sign all apks (in current directory) with: sign.py
  6. [Tried with & without this step]; Align all apks (in current directory) with: align.py
  7. Install all apks with adb install-multiple app1.apk app2.apk ... OR
    Create a zip folder containing all the apks, icon.png, manifest.json

Frameworks

Not from a framework

APK

https://apkcombo.app/wattpad/wp.wattpad/download/phone-10.95.0-apk

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? - Yes
  2. If you are trying to install a modified apk, did you resign it? - Yes
  3. Are you using the latest apktool version? - Yes

Update: I don't get any error (or warning) when decompiling or recompiling. So I've included adb's logcat here.

Additional Information

Not a issue with the original xapk itself. I could successfully install the original xapk (and with adb too).

When the wp.wattpad.apk (base apk) is decompiled, it contains a lot of @null values, like

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@null"/>
<service android:foregroundServiceType="shortService" android:icon="@null" android:name="wp.wattpad.migration.MigrationService"/>

and in many more. (This's from AndroidManifest.xml)

There're apks for multiple resolutions: config.hdpi.apk, config.ldpi.apk, config.mdpi.apk, config.tvdpi.apk, config.xhdpi.apk, config.xxhdpi.apk, config.xxhdpi.apk, so could it be that apktool replaces original resources with @null as they're not available in the base apk?

Furthermore, the target Android version seemed to be 15, which's more interesting.

@fastman92
Copy link

fastman92 commented Feb 15, 2025

I'm trying it on 'Opera browser beta' with the same problem.

Problem is the following:

base.apk has AndroidManifest.xml and resources.arsc

Let's see AndroidManifest.xml in Android Studio (Analyze APK option):
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@ref/0x7f080413" /

Let's see base.apk's resources.arsc.
It contains ID 0x7f080413, however no name is defined. It's also not defined for any DPI resolution.

Image

This symbol is available for xxhdpi resolution in another APK package (split_config.xxhdpi.apk):

Image

It has got a name drawable/notification_smali

Solution:
Allow res/values/public.xml to contain names of symbols that are not defined. Currently it would say the following if symbol in public.xml is declared, but its definition cannot be found for any DPI:
W: R:\tmp\decompiledBase\res\values\public.xml:19946: error: no definition for declared symbol 'com.opera.browser.beta:drawable/notification_small'.

Currently this is not allowed.

For decompilation, add the possibility to specify more APK packages from which resource IDs will be derived.
Add an option like this:
-additional_apks "R:\tmp\unpackedAPKs\split_config.xxhdpi.apk:R:\unpackedAPKs\R:\tmp\unpackedAPKs\ssplit_config.xxxhdpi.apk:R:\tmp\unpackedAPKs\split_mintegral_ads.apk"

resources.arsc to be loaded from these additional APK packages and IDs to be put inside of res/values/public.xml properly. AndroidManifest.xml should be decompiled then.

Thanks for this great project by the way.

@sipsuru sipsuru changed the title [BUG] XAPK Base apk Invalid Decompile | @null as value in xml | Android 15 Target SDK [BUG] XAPK Base APK - Invalid Resource Decompilation | @null in XML Resources | Android 15 Target SDK Feb 17, 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

No branches or pull requests

2 participants