Apktool: Use Apktool(2.2.2) rebuild unmodified weixin6.3.7.apk found error: No resource identifier found for attribute in package 'com.tencent.mm', however V2.0.3 is ok

Created on 7 Feb 2017  ·  13Comments  ·  Source: iBotPeaches/Apktool

Information

  1. Apktool Version (2.2.2) -
  2. Operating System (Mac) -
  3. APK From? (http://weixin.qq.com/cgi-bin/readtemplate?lang=zh_CN&t=weixin_faq_list) -

Stacktrace/Logcat

Below is use 2.2.2 version to rebuild unmodified weixin6.3.7:

W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:5: error: No resource identifier found for attribute 'key' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:5: error: No resource identifier found for attribute 'layout' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:6: error: No resource identifier found for attribute 'persistent' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:6: error: No resource identifier found for attribute 'title' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:6: error: No resource identifier found for attribute 'key' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:6: error: No resource identifier found for attribute 'layout' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:7: error: No resource identifier found for attribute 'title' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:7: error: No resource identifier found for attribute 'key' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:7: error: No resource identifier found for attribute 'layout' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:9: error: No resource identifier found for attribute 'title' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:9: error: No resource identifier found for attribute 'key' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:9: error: No resource identifier found for attribute 'layout' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:10: error: No resource identifier found for attribute 'title' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:10: error: No resource identifier found for attribute 'key' in package 'com.tencent.mm'
W:
W: /Users/yanzi/work/d-apk/weixin2/weixin637/res/xml/z.xml:10: error: No resource identifier found for attribute 'layout' in package 'com.tencent.mm'
W:
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_5322325296887264747.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, --no-version-vectors, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL3485422076297709042.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, assets/emojicompactfile, -0, data, -0, svg, -0, apk, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:477)
    at brut.androlib.Androlib.buildResources(Androlib.java:411)
    at brut.androlib.Androlib.build(Androlib.java:310)
    at brut.androlib.Androlib.build(Androlib.java:263)
    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): [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_5322325296887264747.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, --no-version-vectors, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL3485422076297709042.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, assets/emojicompactfile, -0, data, -0, svg, -0, apk, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:440)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:463)
    ... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_5322325296887264747.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, --no-version-vectors, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL3485422076297709042.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, assets/emojicompactfile, -0, data, -0, svg, -0, apk, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:95)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:434)
    ... 6 more

Below is use Apktool(2.0.3) log:

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/drawables.xml:165: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/drawables.xml:358: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/layouts.xml:165: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/layouts.xml:341: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/strings.xml:170: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/strings.xml:352: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/dimens.xml:165: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/dimens.xml:341: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/styles.xml:791: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/styles.xml:2168: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/colors.xml:165: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/colors.xml:341: error: invalid symbol: 'if'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/ids.xml:75: error: invalid symbol: 'do'

/Users/yanzi/work/d-apk/weixin2/weixin637/res/values/ids.xml:251: error: invalid symbol: 'if'

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_4887173892981919240.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL8826980659801902946.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, , -0, data, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:472)
    at brut.androlib.Androlib.buildResources(Androlib.java:410)
    at brut.androlib.Androlib.build(Androlib.java:298)
    at brut.androlib.Androlib.build(Androlib.java:268)
    at brut.apktool.Main.cmdBuild(Main.java:225)
    at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_4887173892981919240.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL8826980659801902946.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, , -0, data, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:458)
    ... 5 more
Caused by: brut.common.BrutException: could not exec command: [/var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/brut_util_Jar_4887173892981919240.tmp, p, --forced-package-id, 127, --min-sdk-version, 15, --target-sdk-version, 23, --version-code, 861, --version-name, 6.3.25, -F, /var/folders/_5/kf4fq49x0795vwcnlxblvkpr0000gn/T/APKTOOL8826980659801902946.tmp, -0, arsc, -0, zip, -0, sec, -0, conf, -0, dat, -0, , -0, data, -0, arsc, -I, /Users/yanzi/Library/apktool/framework/1.apk, -S, /Users/yanzi/work/d-apk/weixin2/weixin637/res, -M, /Users/yanzi/work/d-apk/weixin2/weixin637/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:89)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
    ... 6 more

You can find some do and if errors, use sed replace, and then rebuild is ok!

Steps to Reproduce

  1. apktool d weixin637.apk

  2. apktool b weixin637

APK

If this APK can be freely shared, please upload/attach a link to it.
weixin6.3.7

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? I didn't get to this step
  3. Are you using the latest apktool version? yes

Hello, I use apktool latest version(2.2.2) to decompile weixin6.3.7.apk, nothing change and then rebuild, found so much No resource identifier found for attribute in package com.tencent.mm errors. However, use apktool(2.0.3), there is no such error, after fix do and if errors, and then rebuild is ok. I have tested, from 2.1.1 version later, It will encounter No resource identifier found for attribute in package errors, which make me believe 2.0.3 version is perfect on Mac.

However , when i test on Windows7, I found 2.1.1 is the last ok version for weixin6.3.7.apk on Windows.
So it make me very depressed。

Different with 1421, the attribute is definited by package com.tencent.mm, not android standard package.

Thanks for your help!

Bug

Most helpful comment

from what I understand, there's no easy way to work out the obfuscation, however, you can work around it by skipping decompiling resources with -r when decompiling

All 13 comments

Now I have succeeded in using apktool(2.0.3) to rebuild weixin latest 6.5.4 version.

Okay, so works in 2.0.3, fails in 2.2.2. I wonder if 2.0.3 is really the last release it worked or not. I'll do some investigating.

There is way too much to triage between 2.0.3 and 2.2.2, but I can confirm this is a problem. It seems Tencent applications are always an open bug report here.

On mac, I have tested from one by one version that 2.0.3 is the last ok version. On windows, today I found 2.1.1 can't work actually, and 2.0.3 is ok. That is to say, 2.0.3 is last ok version for weixin decompile and rebuild, which not make No resource identifier found for attribute in package error.

On windows, I have achieved decompile weixin6.5.4.apk, change smali and then rebuild it using 2.0.3 version. There is one more problem on Windows, after decompile, you need delete one line above conf line in apktool.yml.

it seems apk guarded by https://github.com/shwenzhang/AndResGuard or http://jiagu.360.cn will report the following error. May be help?

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/brut_util_Jar_1296716139278307535.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 22, --version-code, 109, --version-name, 1.0.9, -F, /var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/APKTOOL1300636143063894012.tmp, -0, jar, -0, sig, -0, pub, -0, mf, -0, arsc, -I, /Users/pingliu/Library/apktool/framework/1.apk, -S, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/res, -M, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/AndroidManifest.xml]
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:472)
    at brut.androlib.Androlib.buildResources(Androlib.java:410)
    at brut.androlib.Androlib.build(Androlib.java:298)
    at brut.androlib.Androlib.build(Androlib.java:268)
    at brut.apktool.Main.cmdBuild(Main.java:225)
    at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [/var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/brut_util_Jar_1296716139278307535.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 22, --version-code, 109, --version-name, 1.0.9, -F, /var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/APKTOOL1300636143063894012.tmp, -0, jar, -0, sig, -0, pub, -0, mf, -0, arsc, -I, /Users/pingliu/Library/apktool/framework/1.apk, -S, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/res, -M, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:425)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:458)
    ... 5 more
Caused by: brut.common.BrutException: could not exec command: [/var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/brut_util_Jar_1296716139278307535.tmp, p, --forced-package-id, 127, --min-sdk-version, 14, --target-sdk-version, 22, --version-code, 109, --version-name, 1.0.9, -F, /var/folders/p3/d0_1vgld43bdh3f61xbb8l6m0000gn/T/APKTOOL1300636143063894012.tmp, -0, jar, -0, sig, -0, pub, -0, mf, -0, arsc, -I, /Users/pingliu/Library/apktool/framework/1.apk, -S, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/res, -M, /Users/pingliu/Desktop/others/kaifazhushou/apkdir/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:89)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:419)
    ... 6 more

apktool_2.0.3 don't decompile the layout folder

@JDEast1029 What do I need to do to modify the layout file? 2.0.3 error


: Using Apktool 2.0.3
Exception in thread "main" Can't construct a java object for tag:yaml.org,2002:brut.androlib.meta.MetaInfo; exception=Class not found: brut.androlib.meta.MetaInfo
 in 'reader', line 1, column 1:
    !!brut.androlib.meta.MetaInfo
    ^

        at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:333)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141)
        at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127)
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481)
        at org.yaml.snakeyaml.Yaml.load(Yaml.java:412)
        at brut.androlib.Androlib.readMetaFile(Androlib.java:261)
        at brut.androlib.Androlib.build(Androlib.java:275)
        at brut.androlib.Androlib.build(Androlib.java:268)
        at brut.apktool.Main.cmdBuild(Main.java:225)
        at brut.apktool.Main.main(Main.java:84)
Caused by: org.yaml.snakeyaml.error.YAMLException: Class not found: brut.androlib.meta.MetaInfo
        at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:633)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:321)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331)
        ... 10 more
转换完毕 生成的apk在F:\QQ_weichat\wechat\gongcun\new_657\weixin_6.5.7_1041_gf.apk_dir/dist/目录下


at 2.3.4


:
W: F:\QQ_weichat\wechat\gongcun\new_657\weixin_6.5.7_1041_gf.apk_dir\res\layout\g7.xml:4: error: Error: No resource foun
d that matches the given name (at 'style' with value '@style/MMFooter').
W:
W: F:\QQ_weichat\wechat\gongcun\new_657\weixin_6.5.7_1041_gf.apk_dir\res\layout\g7.xml:12: error: Error: No resource fou
nd that matches the given name (at 'style' with value '@style/MMEditText').
W:
W: F:\QQ_weichat\wechat\gongcun\new_657\weixin_6.5.7_1041_gf.apk_dir\res\layout\g7.xml:17: error: Error: No resource fou
nd that matches the given name (at 'style' with value '@style/ChattingUIWordCount').
W: F:\QQ_weichat\wechat\gongcun\new_657\weixin_6.5.7_1041_gf.apk_dir\res\layout\pu.xml:8: error: Error: No resource foun
d that matches the given name (at 'style' with value '@style/MMList').

@yanzi1225627 I don't understand what you're saying. I need to change all the files, including any layout files, or I'll manually modify the dex.

Same issue, still happening on apktool 2.3.0 on:
https://apkpure.com/wechat/com.tencent.mm/download/1101-APK

i have the same problem that confused to me

Why 2.0.3 is OK

2.0.3 do not decode r directory.

Any updates?

from what I understand, there's no easy way to work out the obfuscation, however, you can work around it by skipping decompiling resources with -r when decompiling

Was this page helpful?
0 / 5 - 0 ratings