使用apktool反编译apk文件的资源信息
2014-02-19 11:16
471 查看
简介
我们做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
plaincopy
Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [...]
COMMANDs are:
d[ecode] [OPTS] <file.apk> [<dir>]
Decode <file.apk> to <dir>.
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.
-b, --no-debug-info
Baksmali -- don't write out debug info (.local, .param, .line, etc.)
-f, --force
Force delete destination directory.
-t <tag>, --frame-tag <tag>
Try to use framework files tagged by <tag>.
--frame-path <dir>
Use the specified directory for framework files
--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] [<app_path>] [<out_file>]
Build an apk from already decoded application located in <app_path>.
It will automatically detect, whether files was changed and perform
needed steps only.
If you omit <app_path> then current directory will be used.
If you omit <out_file> then <app_path>/dist/<name_of_original.apk>
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.
-a, --aapt
Loads aapt from specified location.
if|install-framework <framework.apk> [<tag>] --frame-path [<location>]
Install framework file to your system.
For additional info, see: http://code.google.com/p/android-apktool/
For smali/baksmali info, see: http://code.google.com/p/smali/
反编译命令:
[html] view
plaincopy
> java -jar apktool.jar decode apk文件所在路径
我们以易信为例:
反编译之后,我们就可以在res文件夹下查看易信的xml布局文件
我们做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
plaincopy
Usage: apktool [-q|--quiet OR -v|--verbose] COMMAND [...]
COMMANDs are:
d[ecode] [OPTS] <file.apk> [<dir>]
Decode <file.apk> to <dir>.
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.
-b, --no-debug-info
Baksmali -- don't write out debug info (.local, .param, .line, etc.)
-f, --force
Force delete destination directory.
-t <tag>, --frame-tag <tag>
Try to use framework files tagged by <tag>.
--frame-path <dir>
Use the specified directory for framework files
--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] [<app_path>] [<out_file>]
Build an apk from already decoded application located in <app_path>.
It will automatically detect, whether files was changed and perform
needed steps only.
If you omit <app_path> then current directory will be used.
If you omit <out_file> then <app_path>/dist/<name_of_original.apk>
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.
-a, --aapt
Loads aapt from specified location.
if|install-framework <framework.apk> [<tag>] --frame-path [<location>]
Install framework file to your system.
For additional info, see: http://code.google.com/p/android-apktool/
For smali/baksmali info, see: http://code.google.com/p/smali/
反编译命令:
[html] view
plaincopy
> java -jar apktool.jar decode apk文件所在路径
我们以易信为例:
反编译之后,我们就可以在res文件夹下查看易信的xml布局文件
相关文章推荐
- 使用apktool反编译apk文件的资源信息
- 使用apktool反编译apk的资源文件与manifest文件报:Error: Unable to access jarfile XXXXX
- 使用apktool反编译apk获取资源文件
- 获取app中的资源文件:反编译APK之---------apktool
- apk文件反编译工具apktool的下载,安装,使用
- Apktool反编译apk资源文件
- apktool反编译apk,提取资源文件
- apktool反编译apk,提取资源文件
- Android apktool反编译资源文件为空解决办法(测试天猫、淘宝等apk成功)
- android使用apktool 和 dex2jar反编译apk文件
- Android apktool反编译资源文件为空解决办法(测试天猫、淘宝等apk成功)
- 反编译apk文件,获取strings.xml文件的内容——使用apktool反编译
- Android apktool反编译资源文件为空解决办法(测试天猫、淘宝等apk成功)
- 使用apktool反编译apk文件
- 使用apktool反编译apk的XML文件
- Android apktool反编译资源文件为空解决办法(测试天猫、淘宝等apk成功)
- 使用apktool反编译apk的XML文件
- 使用apktool编译以及反编译apk文件
- 使用apktool 反编译apk以及使用aapt查看apk信息
- 【转】android出现注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: 某些输入文件使用了未经检查或不安全的操作。 注