zoukankan      html  css  js  c++  java
  • apktool之APK解压、打包

    简介: 
        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 Documents\Desktop\apktool-install-windows-r04-brut1所在的文件夹,输入apktool,出现如下命令即说明安装成功(以下信息,即apktool使用命令)。 

    D:\My Documents\Desktop\apktool-install-windows-r04-brut1>apktool 
    Java代码  收藏代码
    1. Apktool v1.4.3 - a tool for reengineering Android apk files  
    2. Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com>  
    3. Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)  
    4.   
    5. Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [...]  
    6.   
    7. COMMANDs are:  
    8.   
    9.     d[ecode] [OPTS] <file.apk> [<dir>]  
    10.         Decode <file.apk> to <dir>.  
    11.   
    12.         OPTS:  
    13.   
    14.         -s, --no-src  
    15.             Do not decode sources.  
    16.         -r, --no-res  
    17.             Do not decode resources.  
    18.         -d, --debug  
    19.             Decode in debug mode. Check project page for more info.  
    20.         -f, --force  
    21.             Force delete destination directory.  
    22.         -t <tag>, --frame-tag <tag>  
    23.             Try to use framework files tagged by <tag>.  
    24.         --keep-broken-res  
    25.             Use if there was an error and some resources were dropped, e.g.:  
    26.             "Invalid config flags detected. Dropping resources", but you  
    27.             want to decode them anyway, even with errors. You will have to  
    28.             fix them manually before building.  
    29.     b[uild] [OPTS] [<app_path>] [<out_file>]  
    30.         Build an apk from already decoded application located in <app_path>.  
    31.   
    32.         It will automatically detect, whether files was changed and perform  
    33.         needed steps only.  
    34.   
    35.         If you omit <app_path> then current directory will be used.  
    36.         If you omit <out_file> then <app_path>/dist/<name_of_original.apk>  
    37.         will be used.  
    38.   
    39.         OPTS:  
    40.   
    41.         -f, --force-all  
    42.             Skip changes detection and build all files.  
    43.         -d, --debug  
    44.             Build in debug mode. Check project page for more info.  
    45.   
    46.     if|install-framework <framework.apk> [<tag>]  
    47.         Install framework file to your system.  
    48.   
    49. For additional info, see: http://code.google.com/p/android-apktool/  



    2、使用 
      1).解压APK 
    D:\My Documents\Desktop\apktool-install-windows-r04-brut1>apktool d F:\document\APK\PushAd.apk F:\document\app 
    源文件:F:\document\APK\PushAd.apk 
    解压目录:F:\document\app 
    Java代码  收藏代码
    1. I: Baksmaling...  
    2. I: Loading resource table...  
    3. I: Loaded.  
    4. I: Loading resource table from file: D:\My Documents\apktool\framework\1.apk  
    5. I: Loaded.  
    6. I: Decoding file-resources...  
    7. I: Decoding values*/* XMLs...  
    8. I: Done.  
    9. I: Copying assets and libs...  


      2).打包APK 
    D:\My Documents\Desktop\apktool-install-windows-r04-brut1>apktool b F:\document\app F:\\document\\app.apk 
    源文件:F:\\document\\app 
    打包目录:F:\document\app.apk 
    Java代码  收藏代码
    1. I: Checking whether sources has changed...  
    2. I: Smaling...  
    3. I: Checking whether resources has changed...  
    4. I: Building resources...  
    5. I: Building apk file...  
  • 相关阅读:
    .NET设计模式观察者模式(Observer Pattern)
    .NET设计模式建造者模式(Builder Pattern)
    .NET设计模式结构型模式专题总结
    MFC深入浅出MFC的进程和线程
    .NET设计模式享元模式(Flyweight Pattern)
    MFC深入浅出CObject类
    不足80行,一种清晰而又简单通用的分页算法,你有这么想过吗?C#版
    .net生成静态页方法总结
    仅IE9/10/(Opera)同时支持script元素的onload和onreadystatechange事件
    结果分类Ajax之三
  • 原文地址:https://www.cnblogs.com/jackrex/p/3001328.html
Copyright © 2011-2022 走看看