Android - Phonegap, Extract code from apk
Solution 1
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
Solution 2
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:
- Download Apktool (make sure you've got node.js)
- After installing apktool open node.js
- Find the directory where your target apk is at (using node.js)
- After finding it type on node.js:
apktool d yourApk.apk
- To build a project type:
apktool b yourProjectFolder
Hope it helped, if you need some help you can leave a comment that I'll be glad to help you!
Related videos on Youtube
Vinu123
Updated on September 15, 2022Comments
-
Vinu123 over 1 year
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
-
Vinu123 about 11 yearsThank you so much.. it helped!! :)