Efficiently Decompile and Recompile Jar Files

Are you looking for a way to decompile and recompile Jar Files? As you probably know, the Jar executable files are a set of files packed in the Android system which comprise of functionality of any app or module. If you have already decompiled an APK file, then you know that even with no jar files in the package, they still function and I am sure that some of you are confused.

Things have though a logical explanation: Android uses a classes.dex file which runs on the Dalvik runtime, so if you want to do some simple modifications to some functions in an Android system, you decompiling these DEX files is mandatory. The Jar files have such DEX file which can be easily decompiled and recompiled resulting in a set of Smali files which are the assembler files for the Android runtime.

Here you can find a detailed very guide of decompiling a.jar file and recompiling it again. However, before starting, I want to clarify something: if you make any mistake, if you mix the steps or skip them, there are big chances to end up with a bricked device and this is only your responsibility. I am not responding of any consequences that might occur during the process, so be careful and make no mistake:

How to Efficiently Decompile and Recompile Jar Files:

  1. Download the Apktool & smali files zip on your computer by accessing the provided link;
  2. Then, you have to copy the Jar file that you want to decompile to the same directory where you have extracted the Apktool file;
  3. Open the .jar file using an archive software of your choice;
  4. Extract the classes.dex file to the Apktool folder;
  5. It’s time to decompile the DEX file by dragging the classes.dex file onto the Quick-Baksmali.cmd file in the Apktool folder;
  6. This will automatically decompile the DEX file and will also create a folder called Classout in the same directory where the smali files are placed;
  7. Save the edited smali files;
  8. Drag the classout folder onto the Quick-Smali.cmd file;
  9. This script will recompile the smali files and provide you a compact DEX file with the name new-classes.dex;
  10. Open the Jar file and delete the classes.dex file;
  11. Now, you can replace it with the compiled classes.dex;
  12. Push the Jar file to the proper location with the help of an ADB Push command.

If you get any error or any problem following this guide, don’t hesitate to comment and I will help you as soon as possible.

Also learn How to: