Thursday, December 26, 2013

Trying to execute/debug an existing APK file with Eclipse [android help]


Trying to execute/debug an existing APK file with Eclipse



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:


  1. I renamed the .apk to .zip and unzip into a folder.

  2. In Eclipse, I created a new "Android project from existing code". In the next screen, "Import Projects", I browsed to the folder where the apk was unzipped.

But this project has errors in Eclipse! So I tried the next steps:


  1. I executed apktool on the .apk, and it created a folder which I use for the same import mentioned in step 2. Now the project no longer has errors.

  2. In Eclipse, I "run as" or "debug as" this project as an Android application, and it starts on the emulator.

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?



Read more

stackoverflow.comm



1 comment:

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...