3

I have used dex2jar with the help of THIS tutorial to extract .class files, and used jd-gui to view the classes. but I cant edit in jd-gui so, through jd-gui, I "Saved All Resources", now I have a .zip with .java classes so I edited them with a Notepad++. So now I have a .zip with all the classes in .java and I edited what I wanted, how do I build back everything to a .apk to install to the phone? Is this the wrong way to edit a .apk?
Thanks.

Omar
  • 7,835
  • 14
  • 62
  • 108

2 Answers2

4

If the decompiler does not decompile all correctly (in fact with obfuscation you'll never get a code without errors) you can't recompile the code...

If you edit the classes into eclipse, you'll see that there are a bunch of errors and a bunch of $NameClassNumber and other stuff.

Maybe you can edit than repackage some resources, but the code not (luckily).

Marco Grassi
  • 1,202
  • 9
  • 14
  • It depends on the result of decompilation.. If you can retrieve a functional code or you are skilled in fixing it you can edit it. http://stackoverflow.com/questions/2953532/is-it-even-possible-to-modify-apk-by-adding-additional-class-to-dex-and-re-pac – Marco Grassi Jun 17 '11 at 09:27
  • Omar you can edit the smali files then repackage in a functional apk, but it's not java. – Marco Grassi Sep 14 '11 at 23:01
4

I have never had good results of dex2jar.

I extract the dex file from the jar with 7-zip, then use baksmali http://code.google.com/p/smali/ to decompile the dex file to ".smali" files (not as easy to understand as class files but it's manageable), and then use smali (included with baksmali) to recompile. Use 7-zip again to put the new classes.dex file back in the jar and done.

Hotmann
  • 41
  • 2