Apk only runs in debug mode. Apk started with “Run” in Eclipse stops on breakpoints

自作多情 提交于 2019-12-04 23:56:10

I encountered same issue. The solution is, restarting your device. Good luck.

You said you have breakpoints?

Try:

Window -> Preferences -> Run/Debug(expand) -> Launching

There should be a section entitled "Launch in debug mode when workspace contains breakpoints"

If that is not on "Never" that would be your problem.

I have the same problem and I need 4 steps to resolve them:

  1. Disconnect the device
  2. Reboot the device
  3. Clean and build all the projects in workspace.
  4. Start the app in emulator in Run mode and check it's ok.
  5. Start the app in the device in Run mode and all works ok.

Only restarting the device not works for me!

I've encountered same problem: I could run my application only in debug mode, but it won't properly start when I press 'run' button. I've tried all solution here, but nothing works for me.

After some time I've found android.os.Debug.waitForDebugger(); in the begining of my Activity. I hope this answer sometimes help someone, because this question was first in Google, when I search for help.

Update

Use Intellij instead of Eclipse for Android development (far fewer IDE interface bugs) and then disregard the following altogether:

Two important rules I've found since the original post:

1) Get in the habit of waiting until Eclipse is finished build the workspace - the indicator shows up in the bottom left corner of Eclipse by default. WS build times can take minutes in a large project with multiple libs. Don't change anything until the build is complete.

2) Close all projects in the workspace and reopen them one-at-a-time starting with the project with no lib dependencies and so on. Make sure not to open a project until you can verify the the workspace has finished building what is already open. Fix any issues along the way before opening the next project.

Good luck.

Happens to me sometimes - have you uninstalled the application completely from the handset and tried to reinstall? Can you install the apk and then disconnect the handset from the machine? (obv won't work if you're using an emulator)

Faced same issue on Samsung S4 and issue is fixed by unchecking "Wait for debugger" option under "Developer options".

Had the same issue, check that you haven't got this line of code anywhere in your project:

android.os.Debug.waitForDebugger();

It may exist in a Service for debugging purposes, once you comment it out it will work in release mode. The problem is that this line of code waits for the debugger, and if you're not running in debug mode it will wait indefinitely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!