使用apktool反编译apk文件的资源信息

简介

我们做web开发的时候,如果想要模仿某一网站的UI,我们可以通过浏览器自带的工具:查看源代码(html),网页中的图片资源以及样式等信息都可以下载到。然后我们用到自己的项目中去,免去了
一些UI设计师的麻烦。即便我们重新设计页面,别人的UI也可以作为参考。而在Android开发中,怎么样才能查看别人apk中的资源呢?
1.图片资源
如果想要查看其他apk的图片资源,我们只需要解压apk文件即可。不需要反编译也可以抽取apk中的图片资源
2.xml布局代码等
如果仅仅通过解压,我们获得的xml文件打开时是乱码,没有办法参考。
解决方案:
使用apktool.jar反编译工具
a.下载地址:
http://android-apktool.googlecode.com/files/apktool1.5.2.tar.bz2
b.下载之后,解压之后,就一个apktool.jar文件
c.使用apktool.jar解压apk文件
条件:
1).JDK是必不可少的
2).JDK环境变量配置
使用:
打开windows的cmd或者linux下的终端,将当前目录切换到apktool.jar所在目录

使用提示:

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [...]  
  2.   
  3. COMMANDs are:  
  4.   
  5.     d[ecode] [OPTS] <file.apk> [<dir>]  
  6.         Decode <file.apk> to <dir>.  
  7.   
  8.         OPTS:  
  9.   
  10.         -s, --no-src  
  11.             Do not decode sources.  
  12.         -r, --no-res  
  13.             Do not decode resources.  
  14.         -d, --debug  
  15.             Decode in debug mode. Check project page for more info.  
  16.         -b, --no-debug-info  
  17.             Baksmali -- don't write out debug info (.local, .param, .line, etc.)  
  18.   
  19.         -f, --force  
  20.             Force delete destination directory.  
  21.         -t <tag>, --frame-tag <tag>  
  22.             Try to use framework files tagged by <tag>.  
  23.         --frame-path <dir>  
  24.             Use the specified directory for framework files  
  25.         --keep-broken-res  
  26.             Use if there was an error and some resources were dropped, e.g.:  
  27.             "Invalid config flags detected. Dropping resources", but you  
  28.             want to decode them anyway, even with errors. You will have to  
  29.             fix them manually before building.  
  30.   
  31.     b[uild] [OPTS] [<app_path>] [<out_file>]  
  32.         Build an apk from already decoded application located in <app_path>.  
  33.   
  34.         It will automatically detect, whether files was changed and perform  
  35.         needed steps only.  
  36.   
  37.         If you omit <app_path> then current directory will be used.  
  38.         If you omit <out_file> then <app_path>/dist/<name_of_original.apk>  
  39.         will be used.  
  40.   
  41.         OPTS:  
  42.   
  43.         -f, --force-all  
  44.             Skip changes detection and build all files.  
  45.         -d, --debug  
  46.             Build in debug mode. Check project page for more info.  
  47.         -a, --aapt  
  48.             Loads aapt from specified location.  
  49.   
  50.     if|install-framework <framework.apk> [<tag>] --frame-path [<location>]  
  51.         Install framework file to your system.  
  52.   
  53. For additional info, see: http://code.google.com/p/android-apktool/  
  54. For smali/baksmali info, see: http://code.google.com/p/smali/  

反编译命令:

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. > java -jar apktool.jar decode apk文件所在路径  

我们以易信为例:


反编译之后,我们就可以在res文件夹下查看易信的xml布局文件

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值