I am new to Phonegap development. I had developed an app and unfortunately i have lost the entire code. But luckily i have the apk file. Can any one pls help me to extract my code from the apk file (PhoneGap - Andriod) Thanks in advance.
-Vinu
Use apktool to get the resource files out of the apk. Use dex2jar to get a jar file that contains the classes in a format that Eclipse will like. Create an Eclipse project point it at the resource files and the new jar file. Open the jar file with a zip utility and delete the existing resources.
You can see android app has . apk extension. You can extract this apk file like zip files but what you get is only compiled class file you can't simply deal with them. So here comes a tool named apktool, which is used to decompile, rebuild and install frameworks.It decompiles nearly to the source code.
Viewing the contents of an APK file: Since APK files come in compressed ZIP format, any ZIP decompression tool can open it. So, for viewing the contents of an APK file, all you have to do is rename its extension to . zip and open it. Or, you can open it directly through an open dialogue box of a zip application.
Yes, you can. If you copy your .apk file so that is has the .zip extension you should be able to unzip it like any normal zip archive. From that you will be able to retrieve your assest and res folders as well as your AndroidManifest.xml.
If you have written extensive Java code then you will need to decompile the classes.dex file back into Java. Here is a good SO question that covers it:
decompiling DEX into Java sourcecode
If you're trying to decompile someone else's apk, that's prohibited.
If not ;) , let's say that you compiled your apk and deleted the project and you need to retrieve it, you can use Apktool to help you with that:
apktool d yourApk.apk
apktool b yourProjectFolder
Hope it helped, if you need some help you can leave a comment that I'll be glad to help you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With