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

APKTOOL_DUMMY (again): clarifications needed #2095

Closed
renaudcerrato opened this issue Jun 3, 2019 · 6 comments
Closed

APKTOOL_DUMMY (again): clarifications needed #2095

renaudcerrato opened this issue Jun 3, 2019 · 6 comments

Comments

@renaudcerrato
Copy link

renaudcerrato commented Jun 3, 2019

Using 2.4.0, decompiling and re-building the (un-modified) medium application is a smooth process, but the APK is just crashing because of some missing resources:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.medium.reader/com.medium.android.donkey.start.SplashActivity}: android.content.res.Resources$NotFoundException: Drawable com.medium.reader:drawable/splash_background with resource ID #0x7f080188

Obviously, that splash_background.xml file is present in both the original and the rebuilt APK, but the latter is referencing an APKTOOL_DUMMY resource:

<?xml version="1.0" encoding="utf-8"?>
...
    <item android:top="@dimen/sign_in_wordmark_vertical_padding">
        <bitmap android:gravity="top" android:src="@drawable/APKTOOL_DUMMY_161" />
    </item>
</layer-list>

I know this has been discussed in #1773 and #1117, but I'm still not getting why apktool would be unable to decode some resources if they're known to be both present AND used?

Sounds like an apktool bug, rather than some missing or invalid resources.

Any clarifications?

@iBotPeaches
Copy link
Owner

My guess is the answer is the same.

➜  Bug2095 aapt d resources Medium_v3.6.1000077_apkpure.com.apk | grep 'INVALID'
      INVALID TYPE CONFIG FOR RESOURCE 0x7f10005c
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1000e3
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1000e9
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1000f5
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1000f6
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1001ce
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100224
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100245
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100264
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100289
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002d6
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002de
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002e9
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002eb
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002ec
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002ed
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002f9
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002fa
      INVALID TYPE CONFIG FOR RESOURCE 0x7f1002fc
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100300
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100305
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100308
      INVALID TYPE CONFIG FOR RESOURCE 0x7f10030a
      INVALID TYPE CONFIG FOR RESOURCE 0x7f100339

A lot of bugged resources here. I don't see a invalid-type config for the 161 (or 0xA1) so will keep this open till I dig for that resource.

@renaudcerrato
Copy link
Author

Thanks for looking into this. I can understand that some apk contains references to missing/unused resources, but they can't be "invalid" if referenced and effectively in use. Great job anyway, would love to dig into this further.

@renaudcerrato
Copy link
Author

Hi there. Any news on this?

@AyraHikari
Copy link

AyraHikari commented Feb 19, 2020

You need to grab splitted APK in /data/app/com.app/*.apk or export with SAI app.

  • Decompile all apk (if it was SAI exported apks, open as zip then extract apk)
  • Merge all files except values to real APK one, and don't replace anything in here
  • Instead of replace files, you need to merge/replace string files
  • Open both values folder, replace DUMMY to REAL ony
    Example:
    <public type="drawable" name="APKTOOL_DUMMY_b" id="0x7f07000b" />
    Replace to
    <public type="drawable" name="abc_btn_check_to_on_mtrl_000" id="0x7f07000b" />
    By search from public id 0x7f07000b
  • Don't forget to replace DUMMY in any XML files (drawable or styles dir, or etc)
  • Edit AndroidManifest.xml, delete android:isSplitRequired="true" at application tag
  • Then try recompile, and install
  • If apk was force close, check log and check what wrong in there

@iBotPeaches
Copy link
Owner

Closing as duplicate of #2104 - sorry for delay.

@DieHertz
Copy link

DieHertz commented Sep 9, 2022

I know it's a bit old, but could you elaborate here?

Merge all files except values to real APK one, and don't replace anything in here

I wrote a script which does resolving APKTOOL_DUMMY_ names across split APK contents, and also copies all the files into base without overwriting anything, but I didn't omit files like values-hdpi/styles.xml and values-xhdpi/drawables.xml, and ended up with app crashing when trying to find drawables defined in the latter. Removing them solved this issue, but I don't quite understand why, nor why these files are there at all. Were they part of original project or it's just an artifact or quirk of apktool?

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

4 participants