Recompile "Mediatek-res.apk" on Redmi Pro - Android 6.0 #1377

Closed
Fays opened this Issue Dec 8, 2016 · 2 comments

Projects

None yet

2 participants

@Fays
Fays commented Dec 8, 2016 edited

Information

  1. Apktool Version (2.2.2) -
  2. Operating System ( Linux ) -
  3. APK From? ( Miui ) -

Stacktrace/Logcat

Decompilation
java -jar /home/fayz
mediatek-res.apk.zip

/0_HMPro_BETA/Bin-HMPro/apktool-2.2.2.jar d mediatek-res.apk 
I: Using Apktool 2.2.2-164c64-SNAPSHOT on mediatek-res.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/fayz/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

**Recompilation**
java -jar /home/fayz/0_HMPro_BETA/Bin-HMPro/apktool-2.2.2.jar b mediatek-res -o mediatek-res.apk
I: Using Apktool 2.2.2-164c64-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'byteShort' has no default translation.
W: warning: string 'close' has no default translation.
W: warning: string 'drag' has no default translation.
W: warning: string 'gallery_camera_mutex' has no default translation.
W: warning: string 'logo' has no default translation.
W: warning: string 'maximum' has no default translation.
W: warning: string 'minimize' has no default translation.
W: warning: string 'mw_max_size_string' has no default translation.
W: warning: string 'permlab_receiveCbSms' has no default translation.
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_five.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_five_img').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_five.xml:8: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_five_normal_divider').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_five.xml:8: error: Error: No resource found that matches the given name (at 'layout' with value '@layout/divider').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_four.xml:13: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_four_name').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_four.xml:16: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_four_number').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/account_one.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_one_img').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/date_picker.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/day').
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_7904687843775909372.tmp, p, --forced-package-id, 8, --min-sdk-version, 23, --target-sdk-version, 23, --version-code, 23, --version-name, 6.0, -F, /tmp/APKTOOL1369259991012208336.tmp, -x, -0, arsc, -0, db, -0, arsc, -I, /home/fayz/.local/share/apktool/framework/1.apk, -S, /home/fayz/Téléchargements/mediatek-res/res, -M, /home/fayz/Téléchargements/mediatek-res/AndroidManifest.xml]
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
	at brut.androlib.Androlib.buildResources(Androlib.java:412)
	at brut.androlib.Androlib.build(Androlib.java:311)
	at brut.androlib.Androlib.build(Androlib.java:264)
	at brut.apktool.Main.cmdBuild(Main.java:227)
	at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_7904687843775909372.tmp, p, --forced-package-id, 8, --min-sdk-version, 23, --target-sdk-version, 23, --version-code, 23, --version-name, 6.0, -F, /tmp/APKTOOL1369259991012208336.tmp, -x, -0, arsc, -0, db, -0, arsc, -I, /home/fayz/.local/share/apktool/framework/1.apk, -S, /home/fayz/Téléchargements/mediatek-res/res, -M, /home/fayz/Téléchargements/mediatek-res/AndroidManifest.xml]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:439)
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:464)
	... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_7904687843775909372.tmp, p, --forced-package-id, 8, --min-sdk-version, 23, --target-sdk-version, 23, --version-code, 23, --version-name, 6.0, -F, /tmp/APKTOOL1369259991012208336.tmp, -x, -0, arsc, -0, db, -0, arsc, -I, /home/fayz/.local/share/apktool/framework/1.apk, -S, /home/fayz/Téléchargements/mediatek-res/res, -M, /home/fayz/Téléchargements/mediatek-res/AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:95)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:433)
	... 6 more
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/date_picker.xml:7: error: Error: No resource found that matches the given name (at 'id' with value '@id/year').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/date_picker_dialog.xml:2: error: Error: No resource found that matches the given name (at 'id' with value '@id/datePicker').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/default_account_picker_item.xml:2: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_item_container').
W: 
W: /home/fayz/Téléchargements/mediatek-res/res/layout/default_account_picker_item.xml:4: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_radio').

@iBotPeaches
Owner

So some resources aren't being found. Lets dump the affected file.

➜  Bug1377 aapt d xmltree mediatek-res.apk res/layout/account_five.xml
        E: ImageView (line=17)
          A: android:layout_gravity(0x010100b3)=(type 0x11)0x11
          A: android:id(0x010100d0)=@0x8110000
          A: android:layout_width(0x010100f4)=(type 0x10)0xfffffffe
          A: android:layout_height(0x010100f5)=(type 0x10)0xfffffffe

So there is our id attribute with an pkgId 8 reference. Lets find that resource.

➜  Bug1377 aapt d resources mediatek-res.apk | grep '0x08110000'      
      spec resource 0x08110000 com.mediatek:id/account_five_img: flags=0x00000000
        resource 0x08110000 com.mediatek:id/account_five_img: t=0x12 d=0x00000000 (s=0x0008 r=0x00)

but clever eye, I didn't copy the resourceId exactly.

➜  Bug1377 aapt d resources mediatek-res.apk | grep '0x8110000'      

nothing. So we have aapt dumping a value without a type. I kept thinking it was pkgId 8, which makes sense because there are plenty of pkgId 8 resources in this file, but maybe its related to the new typed value of 8 - bdfc28c

Either way, I'm getting reports of these problems and so far the common things are MIUI and Nougat. I want to close this as a duplicate of #1361 because I think it is, but leaving it open till I get a real spurt of time to investigate things.

@iBotPeaches iBotPeaches self-assigned this Jan 15, 2017
@iBotPeaches iBotPeaches added this to the 2.2.2 - Bug Fixes milestone Jan 15, 2017
@iBotPeaches
Owner
➜  Bug1377 apktool d mediatek-res.apk -f 
I: Using Apktool 2.2.2-b60db0-SNAPSHOT on mediatek-res.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
➜  Bug1377 apktool b mediatek-res
I: Using Apktool 2.2.2-b60db0-SNAPSHOT
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'byteShort' has no default translation.
W: warning: string 'close' has no default translation.
W: warning: string 'drag' has no default translation.
W: warning: string 'gallery_camera_mutex' has no default translation.
W: warning: string 'logo' has no default translation.
W: warning: string 'maximum' has no default translation.
W: warning: string 'minimize' has no default translation.
W: warning: string 'mw_max_size_string' has no default translation.
W: warning: string 'permlab_receiveCbSms' has no default translation.
I: Building apk file...
I: Copying unknown files/dir...
➜  Bug1377 

Confirmed fixed with changes from iBotPeaches/platform_frameworks_base#2

Will be in 2.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment