简体   繁体   中英

"Waiting for debugger to attach" showing even when not running in debug mode

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.

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

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.

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

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.

Check if the option waiting for debugger is actived.

Settings -> Developer options -> Wait for debugger.

I think this it is new from Jelly Bean.

运行此命令,问题将得到解决

adb shell am clear-debug-app

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.

开发人员选项中的“等待调试器”可能已设置为等待您的应用程序。

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

对我来说,我使用 Android Studio 2.1.2I,我点击 Menu Run > Attach debugger to Android process 只有 2 行 __device_name ____app_name 我只是选择 app_name(want to run) 然后点击 OK 然后奇迹发生了。

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 :)

有很多 adb 进程在运行,我将它们全部杀死并开始调试

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

there you can choice your app

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

Your manifest file may contain following permission

Just remove this permission

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM