0

I need to convert some pieces of a class into Jasmin (or if possible, Smali) and mix new codes with disassembled ones together.
What I want to know is: Is that possible? and if yes, How?

(I have diff patches of java files but don't have source code of Jar files, so I decided to do it this way)

Hadi77
  • 127
  • 8
  • That is the definition of compiling. Even if you did it manually, you'd still be compiling, just in your head instead of using a computer program to do it. – user253751 Feb 15 '15 at 23:24
  • I wanted to see if there was another way than "compiling in my mind", so If it is the only way of doing it, I have to learn Jasmin. :D – Hadi77 Feb 16 '15 at 04:48
  • I don't think so. There's all sorts of things the compiler needs that aren't present in *fragments* of source code - like import declarations, and other classes in the same file, and other classes in other files, and which methods are available. – user253751 Feb 16 '15 at 07:19
  • Also the list of local variables in the same method. – user253751 Feb 16 '15 at 07:28

1 Answers1

0

That depend. 1) If you are talking about android code (calsses.dex), you can disasm it using apktool, and then inject/edit the disassembled code. Finally you can reassemble that code (still using apktool, and ofcourse your new code should not contain syntax errors). You will also need to sign your new apk to be able to run it on your android device. 2) If you are just trying to get the source code from some jar, you can just decompile them using a decompiler like JDGUI and the get the source code (in JAVA lang). Be aware that your jar files might be obfuscated, so the resulting source code might be confused or just not working.

I'd say that if you have an apk with that code you want to modify, your best bet is disassembling it with apktool. Else if you are trying to do that just to recover a source code form jars (maybe have you lost your original source code??) you can try a decompiler.

Hope this helps.

Luca D'Amico
  • 3,192
  • 2
  • 26
  • 38
  • I don't want a simple modding in an APK file. What I want is use codes from one android system app in another one. This can be done by disassembling the DEX file and converting .java files into disassembled jasmin codes which are like smali codes and reassemble it again! – Hadi77 Jul 05 '15 at 06:09
  • Sorry, but you are wrong: DISASSEMBLING the DEX (with apktool) will prduce smali codes. DECOMPILING the DEX will procude .java files instead. Of course you can reassemble your files again (using apktool) and make a new modified apk.I do this quite often in my freetime. – Luca D'Amico Jul 06 '15 at 20:16