title: Trying to execute/debug an existing APK file with Eclipse
body: <p>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.</p>
  
  <p>Here are the steps I've done:</p>
  
  <ol>
  <li>I renamed the .apk to .zip and unzip into a folder.</li>
  <li>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.</li>
  </ol>
  
  <p>But this project has errors in Eclipse!  So I tried the next steps:</p>
  
  <ol>
  <li>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.</li>
  <li>In Eclipse, I "run as" or "debug as" this project as an Android application, and it starts on the emulator.</li>
  </ol>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <p>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.</p>
  
  <p>QUESTION 2:
  Where can I put the sources so that Eclipse will find them? Can these source files be either .smali or .java? </p>