apktool b 回编译error: No resource identifier found for attribute 'bgType' in package 解决

尝试回编译qq时出现如下错误:

c:\>apktool b qq -o qqrepack.apk
I: Using Apktool 2.4.1
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: d:\qq\res\layout\about.xml:8: error: No resource identifier found for attribute 'bgType' in package 'com.tencent.mobileqq'
......

改用-r参数:反编译时不解包资源,再回编译即可解决:

c:\>apktool /?
Apktool v2.4.1 - a tool for reengineering Android apk files
with smali v2.3.4 and baksmali v2.3.4
Copyright 2014 Ryszard Wiśniewski 
Updated by Connor Tumbleson 

usage: apktool
......
 -o,--output        The name of folder that gets written. Default is apk.out
 -p,--frame-path    Uses framework files located in .
 -r,--no-res             Do not decode resources.
 ......

反编译:

c:\>apktool d -r qq.apk
I: Using Apktool 2.4.1 on qq.apk
I: Copying raw resources...
I: Baksmaling classes.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes4.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

c:\>

成功回编译:

c:\>apktool b qq -o qqrepack.apk
I: Using Apktool 2.4.1
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 sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether resources has changed...
I: Copying raw resources...
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

c:\>

签名

C:\>"C:\Program Files\Java\jdk1.8.0_241\bin\jarsigner.exe"  -verbose -keystore abc.keystore -signedjar qqrepack_signed.apk qqrepack.apk abc.keystore

经测试,回编译之后的 APK 无法运行,原因在于R文件夹并未打包进去,而是打包了一个 Res 文件夹,导致安装后 APP 图标都显示不正确,故需要用7-zip手动删除 qqrepack.apk 内的 Res 文件夹,然后把原版 qq.apk 内的 R 文件夹拷贝到 qqrepack.apk 内,再重新签名即可使用。

PS1:要用破解版的QQ,否则会闪退
PS2:也可将原版QQ内的R文件夹解压后,拷贝到反编译出的qq\build\apk\内,这样回编译时回自动添加到qqrepack.apk内,无需再通过7-zip操作

你可能感兴趣的:(apktool b 回编译error: No resource identifier found for attribute 'bgType' in package 解决)