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