开发者

Eclipse debugger can't connect to application for 2.3 (gingerbread) simulator

I wrote an application using the API Level 9 and put my breakpoint in the onCreate() method. The simulator for 2.3 took a long time to start but eventually it was up and running. Then it just hung there. In the console this is what I saw:

[2010-12-16 17:11:58 - MyProject] Android Launch!
[2010-12-16 17:11:58 - MyProject] adb is running normally.
[2010-12-16 17:11:58 - MyProject] Performing com.company.MyProject.MainActivity activity launch
[2010-12-16 17:11:58 - MyProject] Automatic Target Mode: Preferred AVD 'Android2.3' is not available. Launching new emulator.
[2010-12-16 17:11:58 - MyProject] Launching a new emulator with Virtual Device 'Android2.3'
[2010-12-16 17:11:59 - MyProject] New emulator found: emulator-5554
[2010-12-16 17:11:59 - MyProject] Waiting for HOME ('android.process.acore') to be launched...
[2010-12-16 17:12:50 - MyProject] HOME is up on device 'emulator-5554'
[2010-12-16 17:12:50 - MyProject] Uploading MyProject.apk onto device 'emulator-5554'
[2010-12-16 17:12:54 - MyProject] Installing MyProject.apk...
[2010-12-16 17:13:23 - MyProje开发者_如何学编程ct] Success!
[2010-12-16 17:13:23 - MyProject] Starting activity com.company.MyProject.MainActivity on device emulator-5554
[2010-12-16 17:13:24 - MyProject] ActivityManager: [1]   Killed                  am start -D -n c...
[2010-12-16 17:15:05 - MyProject] emulator-5554 disconnected! Cancelling 'com.company.MyProject.MainActivity activity launch'!
[2010-12-16 17:15:44 - MyProject] ------------------------------
[2010-12-16 17:15:44 - MyProject] Android Launch!
[2010-12-16 17:15:44 - MyProject] adb is running normally.
[2010-12-16 17:15:44 - MyProject] Performing com.company.MyProject.MainActivity activity launch
[2010-12-16 17:15:44 - MyProject] Automatic Target Mode: Preferred AVD 'Android2.3b' is not available. Launching new emulator.
[2010-12-16 17:15:44 - MyProject] Launching a new emulator with Virtual Device 'Android2.3b'
[2010-12-16 17:15:45 - MyProject] New emulator found: emulator-5554
[2010-12-16 17:15:45 - MyProject] Waiting for HOME ('android.process.acore') to be launched...
[2010-12-16 17:17:10 - MyProject] HOME is up on device 'emulator-5554'
[2010-12-16 17:17:10 - MyProject] Uploading MyProject.apk onto device 'emulator-5554'
[2010-12-16 17:17:10 - MyProject] Installing MyProject.apk...
[2010-12-16 17:18:29 - MyProject] Success!
[2010-12-16 17:18:29 - MyProject] Starting activity com.company.MyProject.MainActivity on device emulator-5554
[2010-12-16 17:18:32 - MyProject] ActivityManager: [1]   Killed                  am start -D -n c...

Notice now my app is killed.

I made sure my eclipse plug-ins were up to date, and that the SDK packages were also updated.

UPDATE 1

I have made some progress. The first time I start the simulator it never connects to the debugger. After the activity is killed, if I start the debugger a second time (without stopping the simulator), it seems to be connecting but not always. If it doesn't connect the second try, it never does in subsequent tries so I have to kill the simulator and restart it. It's still annoying as hell but at least now I have a workaround.

Update 2

I have given up on this.

How can I diagnose this and fix it?


How can I diagnose this and fix it?

I'd personally add plenty of android.util.Log.v() messages along the lines of "onCreate() entered..." (first line of code in onCreate() after calling super.onCreate()), "Performing StepA..." etc.

The time between 'Starting.." and it being killed in your console output is 3 seconds. I understand that about 5 seconds is allowed for onCreate() to complete so it possibly isn't being considered to be 'not responding' unless the emulator allows less time. If you are doing anything time-consuming in onCreate() however, this may be the cause in which case you should use an AsyncTask for the time-consuming stuff.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜