"本文转载自:APK反编译工具在ubuntu的安装及使用"
1.获取编译工具
(1)反编译需要用到的三种工具和其作用如下说明:
-
apktool:获取APK资源文件(图片和布局文件);
-
dex2jar:将APK反编译成源代码 ;
-
jd-gui:查看APK中源代码文件。
(2)反编译工具
-
百度云下载链接:http://pan.baidu.com/s/1dEOfefB
-
密码:gk59
2.配置环境
下载解压后将目录放在/home/user/目录下,jd-gui需要进行安装,命令:
dpkg -i jd-gui_1.4.0-0_all.deb
最后在在.bashrc中进行环境配置:执行 vim ~/.bashrc
# for apktool
export ANDROID_APKTOOL_PATH=/home/user/apktool-install-linux
export PATH=$ANDROID_APKTOOL_PATH:$PATH
# for dex2jar
dex2jar(){ sh /home/user/apktool-install-linux/dex2jar/dex2jar.sh "$1";}
# for jd-jui
jd-gui(){ java -jar /opt/jd-gui/jd-gui.jar "$1";}
修改后执行:source ~/.bashrc
3.使用方法
在终端执行如下命令:
apktool d xxx.apk -->得到apk资源文件
mv xxx.apk xxx.zip -->APK后缀名改为.zip
unzip -r xxx.zip -->解压得到classes.dex
dex2jar classes.dex -->得到classes_dex2jar.jar
jd-gui classes_dex2jar.jar -->得到apk源代码
4.问题
(1)执行:dex2jar classes.dex,出现dex2jar版本不对的问题
安装其他版本的dex2jar,如下路径获取资源:
https://github.com/pxb1988/dex2jar/releases
(2)执行:jd-gui classes_dex2jar.jar,出现如下错误:
Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1845)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3735)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:291)
at org.jd.gui.service.configuration.ConfigurationXmlPersisterProvider.load(ConfigurationXmlPersisterProvider.groovy:51)
at org.jd.gui.service.configuration.ConfigurationPersister$load.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at org.jd.gui.App.main(App.groovy:27)
解决方法:
cd /usr/lib/jvm/java-8-openjdk-amd64/jre/lib
sudo chmod 777 accessibility.properties
vim accessibility.properties
-------------------
注释掉:
# assistive_technologies=org.GNOME.Accessibility.AtkWrapper
网友评论