Apktool在Linux下回编报错No resource identifier found forattribute 'xxxx' in package 'android'

问题描述

apktool 2.3.2在Linux反编译后回编的时候遇到这个问题

No resource identifier found for attribute 'networkSecurityConfig' in package 'android'

原始报错如下:

WARNING: /home/q/system/.../decompile/AndroidManifest.xml:9: error: No resource identifier found for attribute 'networkSecurityConfig' in package 'android'
Aug 22, 2019 10:13:49 AM java.util.logging.LogManager$RootLogger log
WARNING: 
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_2762497147638071752.tmp, p, -v, --forced-package-id, 127, --min-sdk-version, 8, --target-sdk-version, 26, --version-code, 1, --version-name, 1.0.0, --no-version-vectors, -F, /tmp/APKTOOL2034495334025559933.tmp, -0, arsc, -0, arsc, -I, /home/xxxx/.local/share/apktool/framework/1.apk, -S, /home/q/system/.../decompile/res, -M, /home/q/system/.../decompile/AndroidManifest.xml]

主要出在/home/xxxx/.local/share/apktool/framework/1.apk这里,因为这个标签属性是在24之后才有的,所以我更换打包的android.jar为24以上,此时执行回编在Windows下是没有问题的,但是在linux下是错误,原因就是apktool下的framework缓存,

解决方法

1、确认android.jar版本包含报错的属性标签;
2、执行下下面命令清空apktool目录(参考这个目录 /home/xxxx/.local/share/apktool/framework/1.apk),或者直接删除framework也可以。

apktool empty-framework-dir --force

补充说明

apktool 变更查看 apktool documentation.

目前该方法适用于
apktool 2.2.1以上

猜你喜欢

转载自blog.csdn.net/fanwei4751/article/details/100011418