简体   繁体   中英

Android application works on emulator and via USB debugging on device, but not on device standalone

I am writing an application that connects to a web service in a background thread and displays the service response in the foreground activity. The app works as intended both in the emulator and on my phone via USB debugging. However, when I export the app through Eclipse, then install it on the device, it crashes with an "App is not responding. Would you like to close it?" notification.

I have two activities - a main activity with a button, which navigates to the second activity. The second activity creates a ServiceIntent , runs it and displays the result when the service call is complete.

My main trouble here is that the app fails when there is no possibility to actually debug it. I would highly appreciate it if you could point me in any direction here! Have you had this problem before?

Thanks in advance!

I have found the problem - it was an android.os.Debug.waitForDebugger(); inside the onCreate() of the service. It was making the app freeze on the device standalone, but run perfectly while USB debugging. Thank you for the help spacemanaki !

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