Reputation: 27
I have an existing .APK file without any sources. I want to debug it with Eclipse on Bluestacks (or other) emulator. Eventually, I'd like to set a breakpoint, but for now, I just want to get it to run on the emulator. I'm not talking about just using adb to install it on the emulator and then run there. I've been unsuccessful in getting the resulting .apk, built by Eclipse, to run on the emulator.
Here are the steps I've done:
But this project has errors in Eclipse! So I tried the next steps:
No good! The logcat shows errors such as "dalvikv - thread exiting with uncaught exception". And there are other logcat messages about being unable to instantiate application and java.lang.ClassNotFoundException.
QUESTION 1: Can someone tell me what other steps are necessary to turn this into a "good" project? Is there something obvious that I'm missing about Classes?
Once I can get it to either "run as" or "debug as" successfully, then I will want to debug it by setting a breakpoint. But I can't seem to get the source folder right. I have .smali files as a result of the apktool step mentioned in step 3. Also, I've tried various tools, such as dex2jar and jd-gui, so that I have .java files. But whenever I point tell Eclipse the folder where these sources are (and I have "search subfolders" checked), Eclipse says "Source not found". And "Edit Source Lookup Path". I also tried putting the sources in the /src folder of the workspace.
QUESTION 2: Where can I put the sources so that Eclipse will find them? Can these source files be either .smali or .java?
Upvotes: 1
Views: 4185
Reputation: 11
Question 1: You will have many step to get android project from .apk file. This work is named reversing, decoding...
Question 2: Try question 1 you can do it.
Notice: if developer who coded that apk use proguard, you only see follow of code.
Upvotes: 0
Reputation: 6721
So basically what you are trying to do is to extract the source out of a packaged APK file. What you have achieved is the max i could do as well. There's no way to get the exact and true source code due to obfuscations whilst packaging an APK file. So what you have reached to is the max you can get to. I used these tools but never could extract a true .java file as the author may have written. It will contain some compiler addtitons and optimizations which are not understood by eclipse.
Upvotes: 4