AndroidKiller中smali打包錯誤解決

使用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的。

<public type="array" name="categories" id="0x7f020000" />  

那我代碼裏沒有定義這個,所以我就註銷這句

   <!--    <public type="array" name="categories" id="0x7f020000" />  -->

重新編譯成功。
你學會了嗎?如果你的情況是還有其他錯誤,你會自己排查了嗎?

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章