APKTool之APK解压、打包、编译、反编译教程 | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

APKTool之APK解压、打包、编译、反编译教程

点滴 admin 10年前 (2015-06-26) 2603次浏览 已收录 扫描二维码

简介:



    Android apktool是一个用来处理APK文件的工具,可以对APK进行反编译生成程序的源代码和图片、XML配置、语言资源等文件,也可以添加新的功能到APK文件中。用该工具来汉化Android软件然后重新打包发布是相当简单的。





1、安装

   1).首先安装需要JAVA环境,先下载JDK/JRE,点击下载,已经有JAVA环境的可跳过此步



   2).到code.google上下载apktool.jar以及相关文件:http://code.google.com/p/android-apktool/downloads/list

点击下载apktool1.4.3.tar.bz2  和 apktool-install-windows-r04-brut1.tar.bz2



   3).解压apktool-install-windows-r04-brut1.tar.bz2到任意文件夹,然后解压apktool1.4.3.tar.bz2,把apktool.jar拷贝至apktool-install-windows-r04-brut1.tar.bz2解压所在的文件夹下,此时文件下有aapt.exe、apktool.bat及apktool.jar三个应用。



   4).点击开始菜单,运行,输入CMD回车,用cd命令转到刚刚解压的D:My DocumentsDesktopapktool-install-windows-r04-brut1所在的文件夹,输入apktool,出现如下命令即说明安装成功(以下信息,即apktool使用命令)。



D:My DocumentsDesktopapktool-install-windows-r04-brut1>apktool



Java代码



Apktool v1.4.3 – a tool for reengineering Android apk files  

Copyright 2010 Ryszard Wi?niewski  

Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)  

 

Usage: apktool [-q|–quiet OR -v|–verbose] COMMAND […]  

 

COMMANDs are:  

 

    d[ecode] [OPTS] [


]  

        Decode to

.  

 

        OPTS:  

 

        -s, –no-src  

            Do not decode sources.  

        -r, –no-res  

            Do not decode resources.  

        -d, –debug  

            Decode in debug mode. Check project page for more info.  

        -f, –force  

            Force delete destination directory.  

        -t , –frame-tag  

            Try to use framework files tagged by .  

        –keep-broken-res  

            Use if there was an error and some resources were dropped, e.g.:  

            “Invalid config flags detected. Dropping resources”, but you  

            want to decode them anyway, even with errors. You will have to  

            fix them manually before building.  

    b[uild] [OPTS] [] []  

        Build an apk from already decoded application located in .  

 

        It will automatically detect, whether files was changed and perform  

        needed steps only.  

 

        If you omit then current directory will be used.  

        If you omit then /dist/  

        will be used.  

 

        OPTS:  

 

        -f, –force-all  

            Skip changes detection and build all files.  

        -d, –debug  

            Build in debug mode. Check project page for more info.  

 

    if|install-framework <framework.apk> []  

        Install framework file to your system.  

 









For additional info, see: http://code.google.com/p/android-apktool/  













2、使用



  1).解压APK

D:My DocumentsDesktopapktool-install-windows-r04-brut1>apktool d F:documentAPKPushAd.apk F:documentapp

源文件:F:documentAPKPushAd.apk

解压目录:F:documentapp



Java代码



I: Baksmaling…  

I: Loading resource table…  

I: Loaded.  

I: Loading resource table from file: D:My Documentsapktoolframework1.apk  

I: Loaded.  

I: Decoding file-resources…  

I: Decoding values*/* XMLs…  

I: Done.  

I: Copying assets and libs…  



  2).打包APK

D:My DocumentsDesktopapktool-install-windows-r04-brut1>apktool b F:documentapp F:documentapp.apk

源文件:F:documentapp

打包目录:F:documentapp.apk



Java代码



I: Checking whether sources has changed…  

I: Smaling…  

I: Checking whether resources has changed…  

I: Building resources…  







I: Building apk file… </framework.apk>





转载自





http://apktool.shoujifans.com/





供参考





http://blog.csdn.net/a345017062/article/details/6454424








喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。