Not Able to Debug App in Android Studio

Not Able To Debug App In Android Studio

There is a Debug icon on the toolbar. It looks like a little "bug" and is located right next to the Run icon (which looks like a play button). Try launching the application with that.

Click here to debug

Edit: The following is deprecated when using Android Studio with Gradle.

There is also a debug flag in the AndroidManifest.xml file. It is located under the application tag, and should be set to "true", as follows:

<application android:debuggable="true">
</application>

Debug in Android Studio no longer working

I seem to have resolved this by choosing the 'debug' flavour before opening the emulator. It makes sense to need to do that, but 1) it didn't work like that before and 2) if it's now required, it seems like there should be some kind of error message with more details. Hope this helps someone else, though!

Not able to debug app on android device - Android Studio 2.0

The problem is that after installing and starting to launch the app, that debugger client that AndroidStudio starts is unable to connect to the debugger server on the device. This can have many causes, see this answer and the other answer shown on this page and see if one solves the problem for you

To help figure out the problem, look at the 'Console' tab of the 'Debugger' window in AS. One of the first few lines should look like this:

$ adb shell am start -n "com.acme.audtest/com.acme.AudTest" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER -D

Cut and paste that line into a command prompt, REMOVE THE '-D', and execute it.
It your app ('AudTest') comes up without error, the problem is in AS, is communication to the device, or the configuration of the device. If the app doesn't start, it is in the .apk. (Not the complete solution, but starts to point you in the right direction -- for which of the solutions below applies to your situation.)

Choice

First I select the second option, and it worked fine. But then don't know why I change to select first option. So, the debugger shows the message Waiting for application to come online forever. And I did not notice that, just thought another app prevent me debug or that was an issue with Android Studio 2.0.

So, just check to second option will solve my issue. Thank all.

Can't run/debug app on phone while connected through USB while using Android Studio (it disconnects when installing)

TL;DR:

These two android tools' versions were outdated:

  • Android SDK Build-Tools

  • Android SDK Platform-Tools

Update all android tools to the latest version, and make sure no old ones linger around, and you should be good to go. =)


After I tried to upload the APK directly into my phone from Android Studios' "Device File Explorer" tab and it failed with the same behaviour, I knew something was wrong with the adb-server. So I proceeded to run the adb directly from the console with the following commands:

$ adb start-server
$ adb push abcdefg.apk

The server started just fine, and resulted in the same behavior, but this showed me a new error/warning message that I was never shown in Android Studio:

adb server version (30) doesn't match this client (41); killing...

This was enough for me to find questions and blogpost like this one: How to resolve - “adb server version (32) doesn't match this client (36); killing…”

I guess this phone is very new compared to the old Android tools I have installed, so basically, all I had to do was to update these 2 tools (to the latest version) from the Android Studios's Android SDK configuration menu:

  • Android SDK Build-Tools

  • Android SDK Platform-Tools

Android Studio's Android SDK configuration menu

Now, it is very important that you uninstall any old version of the tools that you may have lying around so that there is no chance that those get used (because it did happen to me during the process). You can check it by clicking the "Show package details" checkbox, and only check the latest version:

"Show package details" checkbox

After this, kill adb from the Task Manager (if it was running), and restart Android Studio. This should make sure you are not using any old version.

Unable to attach debugger in Android Studio - localhost:8600 java.net.ConnectException

Quite embarrassing, but it looks like some time ago I had entered an ip address into my /etc/hosts file to test something as localhost and never removed it. I found a comment on another post saying to check that the following is in your /etc/hosts:

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1 localhost

Upon commenting out that spurious line, the debugger is now working. Given I have a dozen or so other IPs in that file (so I can more easily test remote hosts with a friendly name), I must have not noticed this one at the bottom. I think a more foolproof approach to verifying if this is the problem or not is to ping localhost and verify that it resolves to the ip address of 127.0.0.1, e.g.,

$ ping localhost
PING localhost (127.0.0.1): 56 data bytes

Great comments and suggestions from other folks here too, thanks!



Related Topics



Leave a reply



Submit