What's new

Tutorial Convert an Android app (.apk) into a .jar file

Casp

Casp

VIP
VIP
Retired
Platinum Record Scaling the Mountain TotM
Messages
2,994
Solutions
1
Reaction score
6,176
Points
2,772
Sin$
7
NOTE - Works on KitKat (4.4.4) and earlier. Since Dalvik is outdated stuff I'm not sure if this works on later platforms.
I've come to find that most of the APK editors for rooted phones really just suck. Most of the UIs are awful and a good portion of them simply don't work. The ones that do only deal with editing XMLs and not really getting into the meat of the applications. I learn nothing looking at those cheap APK editors that are catered mostly towards people who don't have a general grasp on coding. It's all element editing. I've also found that a lot of the automatic decompilers don't decompile at the smali level and when the APK is recompiled it's buggy and broken to all hell. Luckily, APKs are just glorified ZIPs, so extraction and finding the bones is easy.
Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. The Dalvik VM executes files in its Dalvik Executable (.dex) format, which is based on classes from Java formats. Because of this, .dex files can easily be converted into .jar files and back.

If you can get a copy of your selected app's .apk without root, then this process can be done without rooting your phone.
Obviously, if you're looking to make server-sided edits, this will not help you in achieving this task. This is simply a process to reverse-engineer an app's APK file.

Things you'll need:
Alright, now that you have all the necessary parts, let's get started.
I'm going to be using a simple checkers app I found that I simply named "checkers.apk," so any time you see "checkers.apk" or "checkers," replace that with the folder name of your selected app.
Open up command prompt and put this in:
ee8WSNy.jpg
C:\Users\testa_000\Downloads is the directory where my copy of ApkTool is located. Change the directory to wherever your copy of ApkTool is located. Submit the command.
This will create a new folder, entitled after whatever your APK was called. Naturally, I now have a folder called "Checkers."
The contents of this folder should look like this:
QXeTaPt.jpg
That classes.dex file is what we're looking at. Everything else is generic APK editor dribble, resources.
Now, go back to command prompt and type this in (ignore everything above the red line):
0edncUD.jpg
Now you have a file called src.jar. I forgot to put it in my checkers.apk folder, but you should set the directory for inside your APK's folder. Remember, use your directory for dex2jar, don't copy the directories I have in the picture.
Now you're free to edit whatever the hell you'd like in Java Decompiler. When you're finished, save all sources.
 
Top Bottom
Login
Register