88

My problem:

I ran upon an awkward problem as I was developing my application. As mentioned in the title, every time I install my application (in run mode, not debug!) at start-up the waiting for debugger to connect.. message appears for 1-2-3 seconds, and the application starts.

What I want:

What I would like is to be able to start the application without that message appearing (it only started appearing in the last few days, and I can't remember changing anything related to debugging).

What I've tried:

  • I have tried setting the android:debuggable="false" but if I do this the debugger never attaches and the message never disappears.
  • I have also tried after installing to disable USB Debugging, but still no results.
  • Even if I kill the application and wake it up through an external source (it uses Google's C2D Messaging Framework) it still tries to run in debug mode on wake-up.

I have developed several Android applications and never stumbled upon this. Why wouldn't I be able to start the application in RUN mode? Is there any other way to install the application on the device, without hitting the run button in Eclipse?

I can post code-snippets from the AndroidManifest or from other parts of the code if necessary, but as I already mentioned I wasn't getting this kind of weird behavior several days ago.

Raul Rene
  • 10,014
  • 9
  • 53
  • 75
  • 4
    Restart the device. Look here: [http://stackoverflow.com/questions/4342588/eclipse-android-project-always-lauching-in-debug][1] [1]: http://stackoverflow.com/questions/4342588/eclipse-android-project-always-lauching-in-debug – jersam515 May 13 '12 at 16:29
  • 1
    Restarting the device did the trick for me. – Saeed Neamati Aug 09 '15 at 12:00

15 Answers15

106

Make sure your java files dont have any break point and Restart the device every thing should be normal.

I was experience the same problems where my application was always being run in debug mode. Restarting the device did the trick for me.

and make sure you are using

right click on project-->>Run As -->> Android Application

Akram
  • 7,548
  • 8
  • 45
  • 72
  • 2
    Turns out although I did not have any breakpoints in my code, I had some in the Workspace, and I may have accidentally turned on the *launch in debug whenever the workspace has breakpoints* (see http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/run-debug/ref-launching.htm). Gladly, after 2 restarts I was able to get it running normally. Thank you all for comments and replies ! – Raul Rene May 13 '12 at 17:25
  • 12
    Yes, restarting the device worked for me. Stupid technology :) – Wahib Ul Haq Sep 27 '14 at 15:47
  • 1
    I was getting this error when compiling and building from eclipse. I cleaned the project but no luck. Then I restarted eclipse and still got the error. I then built the project using maven :| Then I knew it was time to look towards stackoverflow. – iceman Dec 09 '14 at 05:42
  • Worked as said, after Restarting my Device, problem solved. Thanks everyone – Naveed Ahmad Mar 17 '16 at 12:46
  • 1
    How can this still be an issue, after so many years? I consider it a bug in Android. – Christine Apr 12 '17 at 08:55
  • @Christine - I'm new to this, but for you this bug has been happening for FIVE years! That's a long time for the Android dev team to be failing :-( – AriesConnolly Dec 14 '22 at 23:53
22

For me the solution was turning off the USB debugging from my device settings, and then turning it on again!

Much quicker than restart the whole device.

Enrichman
  • 11,157
  • 11
  • 67
  • 101
19

I had the same problem using Android Studio. Restarting my cellphone worked for me!

Tnsu KYRK
  • 310
  • 2
  • 4
14

1. Open setting in ur phone.

2. Go to developer options.(About Phone-> Developer Option).

3. Disable the Developer option and again enable the Developer Option.

4. Enable USB debugging and Install via USB.

Sujeet Kumar
  • 1,822
  • 22
  • 25
9

Run this command and the issue will be resolved

adb shell am clear-debug-app
HimalayanCoder
  • 9,630
  • 6
  • 59
  • 60
6

Check if the option waiting for debugger is actived.

Settings -> Developer options -> Wait for debugger.

I think this it is new from Jelly Bean.

Álvaro
  • 2,872
  • 4
  • 20
  • 25
  • For me the option "Wait for debugger" was not actived. But actived it, start the apk, force close apk and unactive the option correct the problem for me. Do the same with "USB debugging" option was not working for me (on OS 4.4.2) – PiR Aug 18 '17 at 09:06
3

I'm assuming this is in the emulator and not on a device. If it is a device, ignore the rest. :p

It sounds like you saved a snapshot of the emulator as the debugger was connecting.

To fix:

1) Go to the AVD control panel, click on the emulator that's affected and hit start
2) when the window pops up, de-select "Launch from snapshot" and leave "Save to Snapshot" selected
3) Start the emulator.
4) Close the emulator
5) On the AVD control panel again start the emulator 6) Check "Launch from snapshot" again

That should fix things up.

EDIT.

Sorry for the wasted space, I read too fast and missed you talking about trying disabling USB Debugging. I have run into the above situation I describe before so I'll leave this answer posted for those who come along who do have such an issue.

Barak
  • 16,318
  • 9
  • 52
  • 84
  • Ok, no problem. I was talking about a device, but maybe someone working on an emulator will find your post useful. – Raul Rene May 13 '12 at 17:08
3

"Wait for debugger"in Developer options may have been set to wait your application.

Shinoo Goyal
  • 601
  • 8
  • 10
2

Do check once that you placed breakpoints. Run app once and if you get the same message do debug as-> debug configuration-> select the app which you need to run and select always prompt to pick device.It will work for sure. It may be stupid, but i faced this problem for a long time and i tried this and this helped me. And if needed restart your device. Thanks

1

For me, I use Android Studio 2.1.2I, I click on Menu Run > Attach debugger to Android process There is only 2 lines __device_name ____app_name I just select app_name(want to run) and click OK then miracle happens.

1

I had the same problem. But restart my Device or clear the Breakpoints don't worked.

I tried : Run --> Attach to Android Process. Select your package and press OK.

and it works :)

lambda
  • 56
  • 5
1

There was so many adb processes running ,I kill them all and its start debugging

3bdoelnaggar
  • 1,109
  • 8
  • 18
0

You can also set your Android App as Debugging-App Settings --> Developer Options --> set Debuging-App

there you can choice your app

lambda
  • 56
  • 5
0

You might have added your app in Select app to be debugged on your phone. In Settings -> Developer Options -> Select app to be debugged

To resolve this, go to Select app to be debugged and click on No apps

Jigish
  • 221
  • 2
  • 9
-6

Your manifest file may contain following permission

Just remove this permission

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>