The hard drive on my laptop just crashed and I lost all the source code for an app that I have been working on for the past two months. All I have is the APK file that is st
There are lots of applications and methods in the market to decompile the apk file into java class but if the app is compiled with ProGuard rule then you are in a big trouble because this rule will shrink all the dex files into a small character name and then you can not trace back the implementation. see https://developer.android.com/studio/build/shrink-code for mode clarification.
Happy Coding...
based on your condition, if your android apk:
such as:
goto:
to auto decode from apk to java sourcecode
steps:
upload
apk file + click Run
+ wait some time + click Download
to get zip + unzip ->
sources/com/{yourCompanyName}/{yourProjectName}
is your expected java source code
use related tool to decompile/crack by yourself:
jadx
/jadx-gui
convert apk
to java sourcecode
download jadx-0.9.0.zip then unzip to got bin/jadx
, then:
jadx-0.9.0/bin/jadx -o output_folder /path_to_your_apk/your_apk_file.apk
sources
and resources
sources/com/{yourCompanyName}/{yourProjectName}
is your expected java sourcecode
jadx-0.9.0/bin/jadx-gui
(Linux's jadx-gui.sh
/ Windows's jadx-gui.bat
) apk
filesave all
or save as Gradle project
eg:
the main method of 3 steps
:
apk/app to dex
dex to jar
jar to java src
detailed explanation:
apk/app to dex
use tool (FDex2
/DumpDex) dump/hook out (one or multiple) dex
file from running app
steps:
root
ed android
FDex2
/DumpDex into XPosed and enable it
dex
from running apprun FDex2
then click your apk name to enable later to capture/hook out dex
/data/data/com/yourCompanyName/yourProjectName
dex
filedex to jar
use tool (dex2jar
) convert (the specific, containing app logic) dex
file to jar
file
download dex2jar got dex-tools-2.1-SNAPSHOT.zip, unzip got dex-tools-2.1-SNAPSHOT/d2j-dex2jar.sh
, then
sh dex-tools-2.1-SNAPSHOT/d2j-dex2jar.sh -f your_dex_name.dex
eg:
dex-tools-2.1-SNAPSHOT/d2j-dex2jar.sh -f com.xxx.yyy8825612.dex
dex2jar com.xxx.yyy8825612.dex -> ./com.xxx.yyy8825612-dex2jar.jar
jar to java src
use one of tools:
convert jar
to java src
for from jar to java src converting effect:
Jadx
> Procyon
> CRF
>> JD-GUI
so recommend use: Jadx
/jadx-gui
steps:
jadx-gui
dex
fileFile
-> save all
eg:
exported java src:
More detailed explanation can see my online ebook Chinese tutorial:
apktool will work. You don't even need to know the keystore to extract the source code (which is a bit scary). The main downside is that the source is presented in Smali format instead of Java. Other files such as the icon and main.xml come through perfectly fine though and it may be worth your time to at least recover those. Ultimately, you will most likely need to re-write your Java code from scratch.
You can find apktool here. Simply just download apktool and the appropriate helper (for Windows, Linux, or Mac OS). I recommend using a tool such as 7-zip to unpack them.