Remotely debugging a running app

Now, building and pushing an app to your device this way will take longer, but it is far more convenient. Next, let's look at how we can debug a running app remotely by performing the following steps:

  1. Go back to your shell or Command Prompt.
  2. Enter the following command:
adb logcat
  1. You will see a stream of logs covering the screen, which is not something very useful.
  2. Enter Ctrl + C (command + C on Mac) to kill the process.
  3. Enter the following command:
//ON WINDOWS
C:Androidsdk oolsmonitor.bat

//ON LINUX/MAC
cd android-sdk/tools/

monitor
  1. This will open Android Device Monitor. You should see your device on the list to the left. Ensure that you select it. You will see the log output start streaming in the LogCat window. Drag the LogCat window so that it is a tab in the main window, as illustrated:
Android Device Monitor showing the LogCat window
  1. Leave the Android Device Monitor window open and running. We will come back to it later.

Now we can build, deploy, and debug remotely. This will give us plenty of flexibility later when we want to become more mobile. Of course, the remote connection we put in place with adb will also work with Android Studio. Yet, we still are not actually tracking any log output. We will output some log messages in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.152.26