Search code examples
javaandroidadbaide-ide

How can I debug an Android application using ADB/AM?


I am using AIDE as an Android IDE. This application built my project successfully and produced the corresponding APK file.

I would like to debug my project. Currently I:

  • open a terminal emulator

  • move to my android project (# not necessary action as app was installed )

    $ cd /sdcard/AppProjects/myproject
    
  • start adb

    $ adb shell
    
  • launch my application with am

    $ am start --user 10 -a android.intent.action.MAIN -n org.package.app/org.package.app.MainActivity
    

But how do I debug this application?


Solution

  • According to the documentation, you should use start -D to enable debugging. So you would use something like this:

    adb shell am start -D --user 10 -a android.intent.action.MAIN -n org.package.app/org.package.app.MainActivity
    

    Also, your application needs to be set as debuggable in your manifest (AndroidManifest.xml):

    android:debuggable="true"