Ive a problem. I am unable to decompile a game apk successfully. I am using apktool. I get many errors and but i get thw files. But then many of its smali files doesnt have a .end method in its code which makes a recompile impossible.

Can someone help me or decompile it?

Its this file https://www.dropbox.com/s/05kj2x4zie734b9/com.asobimo.iruna_en-1.apk?dl=0

Thanks in advance

//Edit: I figured out why it didnt work as I wanted to. The game has some kind of protection in apk since this year. So I used an older version of apk from 2014, and edited its files and set its version to actual version with APK Edit v0.4. Then save new apk and im fine =) Thanks though for you help

  • 2
    just FYI, decompilation is only for you to analyze the program with ease, not to recompile it again. I haven't worked with Java (only with C#), but what you most probably should do is directly patch the bytecode. – rev Feb 8 '15 at 5:50
  • How could i recompile successfully? There are people doing it. But they wont teach how to... my will is to delete detection of a gamehack. A smali file has the detection strings which i replace but then no recompile possibility :( – Seedlord Feb 8 '15 at 10:00
  • as I said, you can't recompile as decompiler's output is not designed to be recompiled again. you'll have to patch the bytecode. hint: change the string to not detect you, should be pretty easy even if you don't understand the bytecode – rev Feb 8 '15 at 18:08

For various reasons, it is generally not possible to decompile a non-trivial program to the point where it can be correctly recompiled. Among other things, there's a lot of things you can do in bytecode that don't correspond to Java language features, and even in the ideal case, it is hard to restructure certain complex code.

Decompilation is useful for understanding code, but if you want to edit it, you need to learn how to patch things at the bytecode level. The easiest way to do this for APKs is using baksmali.

Running baksmali gives you a directory with a smali file for each class in the dex file. You can then edit the smali to make the changes you want, and run smali to reassemble everything into a new dex file. Then of course you have to add your classes.dex back into the apk, then sign and format it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.