NullPointerException for MIUI mab.apk #1370

Closed
xuefer opened this Issue Nov 23, 2016 · 4 comments

Projects

None yet

3 participants

@xuefer
xuefer commented Nov 23, 2016 edited

Information

  1. Apktool Version (apktool -version) -
    2.2.2-2a3d40-SNAPSHOT (or 2.2.1)

  2. Operating System (Mac, Linux, Windows) -
    Linux

  3. APK From? (Playstore, ROM, Other) -
    dev rom of
    http://www.miui.com/download-101.html#163
    system/app/mab.apk
    system/framework/framework-res.apk (and only if i install this one)

Stacktrace/Logcat

I: Using Apktool 2.2.2-2a3d40-SNAPSHOT on mab.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/xuefer/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values / XMLs...
Exception in thread "main" java.lang.NullPointerException
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(ResStyleValue.java:58)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResources.java:516)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:267)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:132)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:108)
at brut.apktool.Main.cmdDecode(Main.java:166)
at brut.apktool.Main.main(Main.java:81)

Steps to Reproduce

  1. apktool d ../../system/app/mab.apk -f

Frameworks

system/framework/framework-res.apk (and only if i install this one)
https://mega.nz/#!rY0WVBxA!9po1WzEsVDpXIa6la9wfQw9N3WE70c3is96Aim2wY5M

APK

https://mega.nz/#!6NF0xQYR!d5_cBkSDRMsyxNKXQpIKetvDskhQuAJbhKxuQaT4AU4

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
    no, not relative

  2. If you are trying to install a modified apk, did you resign it?
    no

  3. Are you using the latest apktool version?
    yes

@Fays
Fays commented Nov 28, 2016

Miui is no longer supported by apktool for a while.

@iBotPeaches
Owner

This is correct. MIUI is no longer supported. I was going to take a look anyway, since the crash might not be related to MIUI.

However, both download links are password protected :/

@xuefer
xuefer commented Dec 2, 2016

link updated. i thought "without key" is without protection LOL

@iBotPeaches iBotPeaches added a commit that referenced this issue Dec 2, 2016
@iBotPeaches Don't write out a null spec c1cb942
@iBotPeaches
Owner

Okay, probably not isolated to MIUI so patched a decode problem. If a resource spec could not be found, it returned null. Then the NPE occurred.

We aren't out of the dust yet though. Building this results in

I: Building resources...
W: /Users/connortumbleson/Desktop/Bug1370/mab/res/layout-v21/abc_screen_toolbar.xml:5: error: No resource identifier found for attribute 'touchscreenBlocksFocus' in package 'android'
W: /Users/connortumbleson/Desktop/Bug1370/mab/res/drawable-v21/abc_ratingbar_indicator_material.xml:7: error: No resource identifier found for attribute 'tileModeX' in package 'android'
W: /Users/connortumbleson/Desktop/Bug1370/mab/res/drawable-v21/abc_ratingbar_small_material.xml:7: error: No resource identifier found for attribute 'tileModeX' in package 'android'

Except this is strange. These resources are in fact in the recent framework dumps. So maybe the attached framework-res is out of date for this application.

➜  Bug1370 aapt d resources framework-res.apk | grep 'tileModeX'
➜  Bug1370 aapt d resources framework-res.apk | grep -i 'tilemodeX'

Yep, that resource is not in the attached framework. So lets decode this again after running apktool empty-framework-dir --force and not use the attached framework.

I: Using Apktool 2.2.2-2a3d40-SNAPSHOT
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...

Decode and built :) Closing as fixed.

@iBotPeaches iBotPeaches closed this Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment