这篇文章上次修改于 1442 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
 ~  apktool b out -o out.apk
I: Using Apktool 2.5.0
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 sources has changed...
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 sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: /Users/m1k3/out/AndroidManifest.xml:73: error: No resource identifier found for attribute 'requestLegacyExternalStorage' in package 'android'
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/mt/s01862mx2tqcxdzskl37f9m40000gn/T/brut_util_Jar_52320120236345932616711840367472645083.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 26, --version-code, 20201201, --version-name, 3.4.0, --no-version-vectors, -F, /var/folders/mt/s01862mx2tqcxdzskl37f9m40000gn/T/APKTOOL376179660557487747.tmp, -e, /var/folders/mt/s01862mx2tqcxdzskl37f9m40000gn/T/APKTOOL5015515268533821776.tmp, -0, arsc, -I, /Users/m1k3/Library/apktool/framework/1.apk, -S, /Users/m1k3/out/res, -M, /Users/m1k3/out/AndroidManifest.xml]

首先将apktool升级到最新
其次查看apk的Androidmanifest.xml文件中android:compileSdkVersion版本
找对应版本的framework-res.apk放置本地

# 从手机中提取
adb pull  /system/framework/framework-res.apk .
# 

执行如下命令即可解决

# 放置匹配的framework-res.apk
 ✘  ~  apktool if framework-res.apk
I: Framework installed to: /Users/m1k3/Library/apktool/framework/1.apk
# 再次重新打包
 ~  apktool b out -o out.apk
I: Using Apktool 2.5.0
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 sources has changed...
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 sources has changed...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...