3

I have an issue here..and its making me really nervous.

I was working on this game, and it was going great, so I took a copy of it on my laptop to work do some work while away from my computer.

long story short, hard-drive failure + poor back ups led to me losing a very important class.

Is there a way to decompile the apk to retrieve the bit of code that was lost? It isn't overly complicated or sophisticated, its just that its impossible to re-write it without reading every. single. line. of. code. in the entire application since it initializes a LOT of classes and loads a bunch of stuff in a specific way.

With a quick google search I was able to find apktool, which decompiles it into a bunch of .smali files, which I don't think were designed for human reading.

All I need to recover is one very big method in the class. I found the smali file that contains it and I think I found the line where it starts. something like

.method public declared-synchronized load(Lcom/X/X/game/X;)I

Anyone help would be appreciated since I would have to scrap the entire game without this method.

1
  • That's why you use source control (off-site, obviously).
    – Femaref
    Commented Nov 25, 2011 at 0:39

1 Answer 1

5

A quick google resulted in a way to decompile apks (decompile apk to java source). However, even though it results in java code, you probably won't have any variable names (just default ones like param1) as those are unrecoverably removed when you compile the source code to byte code, also, depending on the decompiler, for/foreach loops will be while loops instead, if/else blocks might not represent your original control flow due to compiler optimization.

As a general advise: Use some sort of source control. On your own server, paid account with github doesn't matter what, but use source control. Even if you are just one person developing on a project. It helps with this situation, it helps with reverting to a previous version, it helps finding a bug you introduced. When the tools are available, use them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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