我笔记本电脑上的硬盘刚刚崩溃,我丢失了过去两个月一直在开发的应用程序的所有源代码。我只有一个APK文件,它存储在我发给朋友的电子邮件中。

有没有办法从这个APK文件中提取我的源代码?


当前回答

是的,这是可能的。

有很多软件可以对android.apk文件进行反向工程。

最近,我在我的网站上整理了47个最好的APK反编译器的最终列表。我把它们分成4个不同的部分。

开源APK分解器在线APK分解器适用于Windows、Mac或Linux的APK解压缩程序APK分解器应用程序

我希望这本书对你有帮助。

链接:https://www.edopedia.com/blog/best-apk-decompilers/

其他回答

我发现以下是最简单的方法:

将app.apk重命名为app.zip(将扩展名从apk更改为zip)将zip文件解压缩到文件夹中使用JADX工具读取classes.dex文件中的源代码。

虽然您可以反编译APK文件,但您可能会遇到一个大问题:

它不会返回您编写的代码。相反,它将返回编译器内联的任何内容,变量为随机名称,函数为随机名称。尝试反编译并将其还原为您所拥有的代码可能需要比重新开始花费更多的时间。

可悲的是,这样的事情已经扼杀了许多项目。对于未来,我强烈建议学习版本控制系统,如CVS、SVN和git等。

以及如何备份。

是的,这是可能的。

有很多软件可以对android.apk文件进行反向工程。

最近,我在我的网站上整理了47个最好的APK反编译器的最终列表。我把它们分成4个不同的部分。

开源APK分解器在线APK分解器适用于Windows、Mac或Linux的APK解压缩程序APK分解器应用程序

我希望这本书对你有帮助。

链接:https://www.edopedia.com/blog/best-apk-decompilers/

我开发了一个工具代码分析器,它在iPhone/iPad/Mac中运行,用于分析Java/Android文件,https://decompile.io

几天来,我一直想让dex2jar在一台软呢帽31笔记本电脑上与一台无法工作的apk进行比较,这让我发疯了。这个python3脚本在几分钟内就完成了这个任务,安装jdgui使类文件变得可读。

http://java-decompiler.github.io/

https://github.com/Storyyeller/enjarify

具体来说,下面是我运行的:

# i installed apktool before the rest of the stuff, may not need it but here it is
$> cd /opt
$> sudo mkdir apktool
$> cd apktool/
$> sudo wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool
$> sudo wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.4.1.jar
$> sudo mv apktool_2.4.1.jar apktool.jar
$> sudo mv apktool* /usr/bin/
$> sudo chmod a+x /usr/bin/apktool*

# and enjarify
$> cd /opt
$> sudo git clone https://github.com/Storyyeller/enjarify.git
$> cd enjarify/
$> sudo ln -s /opt/enjarify/enjarify.sh /usr/bin/enjarify

# and finally jd-gui
$> cd /opt
$> sudo git clone https://github.com/java-decompiler/jd-gui.git
$> cd jd-gui/
$> sudo ./gradlew build

# I made an alias to kick of the jd-gui with short commandline rather than long java -jar blahblahblah :)
$> echo "jd-gui='java -jar /opt/jd-gui/build/launch4j/lib/jd-gui-1.6.6.jar'" >> ~/.bashrc

现在应该可以使用以下方法获取类文件:

$> enjarify yourapkfile.apk

要启动jd-gui:

$> jd-gui

那就打开你的课堂文件吧!