使用AndroidKiller打开一款app,修改代码后重新编译打包报错如下
当前 Apktool 使用版本:apktool_2.3.2
正在编译 APK,请稍等...
>I: Using Apktool 2.3.2
>I: Smaling smali folder into classes.dex...
>I: Building resources...
>S: WARNING: Could not write to (C:\Users\Administrator\AppData\Local\apktool\framework), using C:\Users\ADMINI~1\AppData\Local\Temp\ instead...
>S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
>W: D:\Program Files\AndroidKiller_v1.3.1\projects\ChaseCamera_v1.0.1\Project\res\values\public.xml:27: error: Public symbol array/categories declared here is not defined.
>brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\ADMINI~1\AppData\Local\Temp\brut_util_Jar_3987554955499107196.tmp, p, --forced-package-id, 127, --min-sdk-version, 19, --target-sdk-version, 28, --version-code, 1, --version-name, 1.0.1, --no-version-vectors, -F, C:\Users\ADMINI~1\AppData\Local\Temp\APKTOOL7150379841642260279.tmp, -0, arsc, -0, META-INF/android.arch.core_runtime.version, -0, META-INF/android.arch.lifecycle_livedata-core.version, -0, META-INF/android.arch.lifecycle_livedata.version, -0, META-INF/android.arch.lifecycle_runtime.version, -0, META-INF/android.arch.lifecycle_viewmodel.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.legacy_legacy-support-v4.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.media_media.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, META-INF/com.android.support_animated-vector-drawable.version, -0, META-INF/com.android.support_appcompat-v7.version, -0, META-INF/com.android.support_cardview-v7.version, -0, META-INF/com.android.support_customtabs.version, -0, META-INF/com.android.support_support-vector-drawable.version, -0, arsc, -I, C:\Users\ADMINI~1\AppData\Local\Temp\1.apk, -S, D:\Program Files\AndroidKiller_v1.3.1\projects\ChaseCamera_v1.0.1\Project\res, -M, D:\Program Files\AndroidKiller_v1.3.1\projects\ChaseCamera_v1.0.1\Project\AndroidManifest.xml]
APK 编译失败,无法继续下一步签名!
报这么多错误,咋个解决呢。这里说下思路。思路是最重要的。
先检查下自己配置是否正确(我自己写一个demo,解包,重新编译,成功,那就说明环境是ok的)
来看看demo编译的日志
当前 Apktool 使用版本:apktool_2.3.2
正在编译 APK,请稍等...
>I: Using Apktool 2.3.2
>I: Smaling smali folder into classes.dex...
>I: Building resources...
>S: WARNING: Could not write to (C:\Users\Administrator\AppData\Local\apktool\framework), using C:\Users\ADMINI~1\AppData\Local\Temp\ instead...
>S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
>I: Copying libs... (/kotlin)
>I: Building apk file...
>I: Copying unknown files/dir...
>I: Built apk...
APK 编译完成!
正在对 APK 进行签名,请稍等...
APK 签名完成!
---------------------------
APK 所有编译工作全部完成!!!
生成路径:
file:D:\Program Files\AndroidKiller_v1.3.1\projects\app-debug\Bin\app-debug_killer.apk
从日志就可以看出两点,第一就是环境是ok的,第二,对于S: WARNING这种信息不用管它,不影响编译。
再回去看我们文章开头的报错,关注点移动到这里
>W: D:\Program Files\AndroidKiller_v1.3.1\projects\ChaseCamera_v1.0.1\Project\res\values\public.xml:27: error: Public symbol array/categories declared here is not defined.
你不知道这个W:
是什么意思?那你总知道这个xml:27: error: Public
是错误的意思吧。上面这句话报错,说是values\public.xml有个叫做categories的,但是你没有定义它。接下来就去’工程搜索’,发现这个是facebook的。
那我代码里没有定义这个,所以我就注销这句
重新编译成功。
你学会了吗?如果你的情况是还有其他错误,你会自己排查了吗?