apktool 簡單使用記錄


修改APP:車來了

修改內容:首次啟動引導頁,中間的點素材修改、樣式修改

修改前:未選中為白色,選中為藍色,間距為5dip

修改后:未選中為紅色,選中為黑色,間距為0

前后截圖如下:

 

修改過程:

一、使用apktool反編譯apk

apktool安裝根據官網進行:https://ibotpeaches.github.io/Apktool/install/

具體操作:

0.首先確保使用java 1.8或以上

1.下載運行腳本並重命名為apktool.bat,下載地址(官網):https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/windows/apktool.bat

2.下載最新的apktool並重命名為apktool.jar,下載地址:https://bitbucket.org/iBotPeaches/apktool/downloads/

3.放在一個文件夾,雙擊運行apktool.bat,會輸出用法

4.反編譯apk,命令格式:apktool d [ apk文件名 ]

Apktool v2.4.0 - a tool for reengineering Android apk fileswith smali v2.2.6 and baksmali v2.2.6
Copyright 2014 Ryszard Wiśniewski <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>

usage: apktool
 -advance,--advanced   prints advance information.
 -version,--version    prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
 -p,--frame-path <dir>   Stores framework files into <dir>.
 -t,--tag <tag>          Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
 -f,--force              Force delete destination directory.
 -o,--output <dir>       The name of folder that gets written. Default is apk.ou
t
 -p,--frame-path <dir>   Uses framework files located in <dir>.
 -r,--no-res             Do not decode resources.
 -s,--no-src             Do not decode sources.
 -t,--frame-tag <tag>    Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
 -f,--force-all          Skip changes detection and build all files.
 -o,--output <dir>       The name of apk that gets written. Default is dist/name
.apk
 -p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: http://ibotpeaches.github.io/Apktool/
For smali/baksmali info, see: https://github.com/JesusFreke/smali

C:\Users\Administrator>cd C:\Users\apk所在文件夾

C:\Users\apk所在文件夾>apktool d chelaile.apk
I: Using Apktool 2.4.0 on chelaile.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
S: WARNING: Could not write to (C:\Users\Administrator\AppData\Local\apktool\framework), using C:\Users\Administrator\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: Loading resource table from file: C:\Users\Administrator\AppData\Local\Temp\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Baksmaling assets/AdDex.3.1.0.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...

得到了文件夾chelaile,里面有如下文件:

二、尋找和修改

這里是純粹的憑感覺在搞了

AndroidManifesr.xml  找到<category android:name="android.intent.category.LAUNCHER"/>

猜測啟動頁面應該是SplashActivity,將其作為本次修改的對象

=> SplashActivity.smali 找到sget p1, Ldev/xesam/chelaile/core/R$layout;->cll_act_splash:I

猜測對應布局文件為cll_act_splash

=> cll_act_splash.xml 發現用了自定義組件GuideView,而且默認設置為gone,在smali文件中有invoke-virtual {v0, v1}, Ldev/xesam/chelaile/app/module/func/GuideView;->setVisibility(I)V,進一步猜測是首次啟動才會出現

=> GuideView.smali 找到sget p2, Ldev/xesam/chelaile/core/R$layout;->cll_act_guide:I,猜測對應布局文件為cll_act_guide.xml

=> cll_act_guide.xml里面三個ImageView,應該就是三個點,

根據android:src="@drawable/indicate_dot" 得到對應素材,直接做修改保存;

刪除android:padding="5.0dip"(由於這里的修改引起了頁面中其他元素在顯示上也有變化)

三、重新打包

命令格式:apktool b [ 剛才得到的文件夾 ] -o [ 輸出文件名 ]

C:\Users\apk所在文件夾>apktool b chelaile -o newcll.apk
I: Using Apktool 2.4.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_assets folder into assets.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes4 folder into classes4.dex...
I: Checking whether resources has changed...
I: Building resources...
S: WARNING: Could not write to (C:\Users\Administrator\AppData\Local\apktool\framework), using C:\Users\Administrator\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: warning: string 'cll_aboard_user_contribution_empty_desc' has no default translation.
W: warning: string 'rc_voice_dialog_cancel_send' has no default translation.
W: warning: string 'rc_voice_dialog_swipe' has no default translation.
W: warning: string 'rc_voice_dialog_time_short' has no default translation.
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...

出現了一些warning,但是問題不大,第一次使用,就不怎么糾結他了

到這里得到了一個apk,但是不能用,需要簽名才能正常安裝

四、重新簽名

用Auto-sign重新簽名,這里參考了一個博客,原文鏈接:https://blog.csdn.net/sxk874890728/article/details/80486223

下載解壓Auto-sign,得到的auto-sign文件夾下有以下文件

將上一步得到的newcll.apk拷貝到解壓好的auto-sign文件夾下,執行命令:

java -jar signapk.jar testkey.x509.pem testkey.pk8 newcll.apk cll_signed.apk

就得到了最終可安裝使用的apk


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM