apktool回编译报错

报错

error: No resource identifier found for attribute 'XXX' in package 'XXX'

解决

将xml文件中 "http://schemas.android.com/apk/res-auto" 修改为 "http://schemas.android.com/apk/lib/com.app.chasebank"

其它

我直接用 Android Killer进行的回编译,这种报错一下子出现了10多个,一个一个改太过麻烦,所以我简单写了一个python脚本:

import os
import re

file = "error.txt"

def change_content(file):
    if os.path.exists(file):
        with open(file) as f:
            content = f.read()
        if "http://schemas.android.com/apk/res-auto" in content:
            print(file+":已修复")
            content = content.replace("http://schemas.android.com/apk/res-auto","http://schemas.android.com/apk/lib/com.app.chasebank")
            with open(file,"w") as f:
                f.write(content)

with open(file,encoding='utf8') as f:
    data = f.read()

result = re.findall(">W: (.*?):\d+: error: No resource identifier found for attribute",data)
for file in result:
    change_content(file)

将错误复制到 error.txt 文件中,然后跑一下脚本,就可以直接修改xml文件。

有时候回编译还会出现这种报错,可能需要再次复制错误,然后执行脚本,也就是说有一些错误不报是因为前面错误没解决,不能一次把所有的这种错误都报出来。

posted @ 2021-09-21 13:58  Hello_wshuo  阅读(105)  评论(0编辑  收藏  举报