androidreverse-engineeringdx

Converting .java back to classes.dex


I've been playing around with reverse engineering and I am having trouble recompiling after making an edit.

I first used apktool:

apktool d input.apk out
apktool b out

I then used dex2jar to convert classes.dex to jar then used JD-GUI to extract the java files. I went in and changed one string value so that everything would still be perserved but could see if it worked, so the code should all work. So I have the folder of the .java file called 'classes' and I've tried to use DX to convert back to a dex file. I enter:

dx --dex classes --no-strict

and get these errors: enter image description here


Solution

  • Your ordering is a little off and you need to specify directories as an absolute path for the tool to recognize them. Try

    dx --dex --output C:/Users/SkyNet/Desktop/new_dex_file.dex C:/Users/SkyNet/Desktop/classes
    

    That should make a new_dex_file.dex file on your desktop from the classes folder than is on your desktop.