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

15

41

I am not able to debug an app on my device (Asus Zenphone 2) after I updated android studio to 2.0. I keep seeing below message in debug tab right after I click on debug icon in Android studio.

Message in debug tab in Android Studio UI

---------------------------------------------------------------
Waiting for application to come online: packagename
Waiting for application to come online: packagename
Waiting for application to come online: packagename
Waiting for application to come online: packagename

I keep seeing Alert Dialog with the title "Waiting for Debugger" and Force close button all the time.

I searched but it seems only two results from google for that message.

I restarted Android studio, checked developer settings on phone...

Have anyone faced with this issue. Please help me. I cannot run the emulator, because my mac will be too lag. Thank you in advance.

Dragrope answered 19/4, 2016 at 16:7 Comment(6)
Are you able to run the app, without the debugger? Is the updated app getting installed, but then just cannot be run by the IDE?Pavyer
Yes, I can run app without the debugger.Dragrope
OK, so it's not something tied to the MAC address registration stuff. You might try disabling Instant Run and see if that helps. You will find that in Settings > Build, Execution, Deployment > Instant Run in Android Studio 2.0.Pavyer
Just disabled Instant Run and there is no luck. I afraid that the phone block app for debugging. When updating Android Studio, I also try to configure something with CM Applock. Then I disable all but still got that error.Dragrope
It is strange that this block only occurred when you upgraded to Android Studio 2.0, though. However, I am out of ideas as to what the problem might be.Pavyer
Does this answer your question? Debugging with Android Studio stuck at "Waiting For Debugger" foreverFokos
D
28

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.

Dragrope answered 22/4, 2016 at 15:54 Comment(0)
I
24

Restarting Android Studios (2.1.1) resolved this for me.

Irmgardirmina answered 7/6, 2016 at 1:58 Comment(3)
Restarting worked for me too. But doing it often is a pain.Sardonyx
I updated to Android Studios 2.1.3 and have not experienced this issue since. Not sure if it is related.Irmgardirmina
I am running on 2.1.3 and still have the same issues. I do not think it is related.Sardonyx
H
14

There are two possibilities:

1.USB Debugging off :

  • Start Developer Option of your devices
  • Switch On USB Debugging

2.In Android-Studio : File -> Invalidate Caches / Restart

anyone can be useful for you.Try it

Heerlen answered 16/8, 2016 at 12:39 Comment(0)
M
9

The correct answer is close your Android Device Manager. None of these suggestions worked for me till I closed it.

Marciano answered 21/1, 2017 at 17:9 Comment(0)
T
8

For me the problem was in "Android Studio" + "Intellij IDEA" running side-by-side. Was fixed by disabling bundled "Android plugin" in "Intellij IDEA". (Note: problem appeared only with some later versions of these IDEs)

Tractor answered 28/6, 2021 at 22:59 Comment(2)
Thanks very much for your reply ... this was the cause of the issue for me. You've saved me a lot of time today.Smorgasbord
Thank you a lot!!! It works for me with Android Studion 2021.1.1 Path 3 (built on March 16, 2022).Chinaman
I
5

Nothing worked for me except one solution...

Clearing the Intellij IDEA (Android Studio) .idea directory which contains configuration information worked for me:

Exit Android Studio Navigate to the project you are trying to debug Backup any files inside .idea that you modified (if your project checks any of these into VCS) Delete .idea directory Open the project in Android Studio

Irregular answered 10/10, 2017 at 19:34 Comment(0)
K
4

I had to remove the parameter

 android:exported = "false"

from the main activity.

Kuvasz answered 14/3, 2017 at 15:26 Comment(0)
M
2

if you get this problem on the emulator, running adb reconnect worked for me. there is a similar command for devices adb reconnect device

Merril answered 23/9, 2016 at 14:22 Comment(0)
E
1

**

This answer might help for those Who have successfully connected their device along netbeans NB Android but on debug there's no application being appear on device.

**

Ok so solution is check your android device version in mobile setting click on about device at last: you will know your android version there.

Now choose the same version for your netbeans android project.

Right click on project name click on properties and then change target with same as your android device.

(In my case android version was 4.4.2 so I selected the same for my project target)

Before to go ahead click on service tab next to project tab in netbeans then right click on Android device and click on restart ADB.

Finally you need to right click on project again and click on clear and build.

Now you can run with hope to get result.

Erund answered 9/5, 2017 at 16:21 Comment(0)
J
1

I had this problem and none of the solutions provided worked for me.

I you had the same issue, you can also try this:

  1. Edit Run/Debug configurations
  2. Select the 'app' or other name's configuration
  3. At the launch Options, change Launch "Nothing" to "Default Activity".

Steps

Jansenism answered 19/12, 2022 at 1:14 Comment(0)
C
0

I just wanted to share my experience as I had the same error and there was no way to solve it using all the solutions you guys posted. I even deleted several times my virtual device, no way to make it work again.

In my App I have a custom permission com.example.CUSTOM_PERMISSION and I wanted to use it to protect my Main Activty from a confused deputy attack.

    <permission android:name="com.example.CUSTOM_PERMISSION"
            android:label="@string/permlab_deadlyActivity"
            android:description="@string/permdesc_deadlyActivity"
            android:permissionGroup="android.permission-group.COST_MONEY"
            android:protectionLevel="dangerous" />

. . .

    <activity
            android:permission="com.example.CUSTOM_PERMISSION"
            android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

Somehow that property android:permission was preventing my app to install and run on the virtual device, even though it could be compiled and build with Gradle successfully. Just after removing it, everything is fine again I am not sure the app is protected this way, I'm building another test app to try performing a confuse deputy and see if the declaration of the custom is just enough.

Hope this can help somebody that was getting mad like me!

Ceolaceorl answered 21/11, 2018 at 9:58 Comment(0)
T
0

I had this problem in the Android emulator, and it was solved by going to Tools->AVD Manager, selecting the device, right click "Cold Boot Now".

Tocci answered 5/2, 2019 at 16:19 Comment(0)
H
0

The solution which helped me is to click on attach the debugger to android Process and set debugger to java.

Hubing answered 7/2, 2019 at 10:30 Comment(0)
C
0

Just throwing my experience in as this just started happening. With regards to all these answers, I tried a few of them and none seemed to work. So I started from scratch:

Initial setup: - USB Debugging ENABLED - Always prompt when connecting to USB (I usually only connect in charge mode) - Allow ADB debugging in charge only mode ENABLED - Wait for debugger DISABLED - Verify apps over USB ENABLED

The steps I took to get debugging back:

  • Close down Android Studio - I didn't go so far as to delete the .idea folder as discussed, but I'm sure it couldn't hurt.
  • DISABLE USB Debugging
  • Revoke USB debugging authorizations
  • Reconnect Device
$ adb devices
> <Device Id> unauthorized
  • ENABLED USB Debugging
  • Reconnect Device
  • When prompted select ALLOW (I clicked always allow)
$ adb devices
> <Device Id> device

Open Android Studio and hit debug - Application started successfully, I was still getting 5-6 of these messages but then it worked:

$ adb shell am start -n "com.exampleapp/com.exampleapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Waiting for application to come online: com.exampleapp.test | com.exampleapp
Connecting to com.exampleapp
Connected to the target VM, address: 'localhost:8600', transport: 'socket'

React Native

As a side note - this happens every so often, I'm not sure whether it's from switching back and forth between running from react-native run-android or debugging in Android Studio, but regardless I've had to do this a couple times (finally decided to document).

Also remember

$ adb reverse tcp:8081 tcp:8081

and to start the packager when debugging (I tend to forget).

Civics answered 19/6, 2019 at 14:12 Comment(0)
S
0

Try to restart ADB. Execute terminal commands:

adb kill-server
adb start-server
Schuck answered 3/6, 2021 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.