5

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?

hichris123
  • 10,145
  • 15
  • 56
  • 70
bioinfornatics
  • 1,749
  • 3
  • 17
  • 36
  • 1
    I found a similar question that might be helpful: http://stackoverflow.com/questions/20205262/how-to-debug-an-android-application-started-from-adb-shell-am-start-d – Micer Mar 01 '14 at 14:53

1 Answers1

5

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"
Micer
  • 8,731
  • 3
  • 79
  • 73
  • And then what happens / how do you connect to it? – Ciro Santilli OurBigBook.com Nov 08 '17 at 07:51
  • You can then use "activity manager (am) tool to perform various system actions, such as start an activity, force-stop a process, broadcast an intent, modify the device screen properties, and more". Check docs: https://developer.android.com/studio/command-line/adb.html ;-) – Micer Nov 20 '17 at 19:01
  • @tanius you're right, I fixed that – Micer Jun 11 '20 at 09:56