Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

android - HelloAndroid emulator problem

I''m trying android SDK for the first time. I'm starting with the HelloAndroid tutorial. followed exactly each step but the emulator launches without my app. eclipse console says:

[2010-02-23 11:47:55 - HelloAndroid]------------------------------
[2010-02-23 11:47:55 - HelloAndroid]Android Launch!
[2010-02-23 11:47:55 - HelloAndroid]adb is running normally.
[2010-02-23 11:47:55 - HelloAndroid]Performing com.example.helloandroid.HelloAndroid activity launch
[2010-02-23 11:47:55 - HelloAndroid]Automatic Target Mode: Preferred AVD 'my_avd' is not available. Launching new emulator.
[2010-02-23 11:47:55 - HelloAndroid]Launching a new emulator with Virtual Device 'my_avd' [2010-02-23 11:48:09 - HelloAndroid]New emulator found: emulator-5554
[2010-02-23 11:48:09 - HelloAndroid]Waiting for HOME ('android.process.acore') to be launched...

I see the emulator, the ''Android'' text on it but nothing else happens. can someone help please? thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Summary
(You can see the full details below these summarized steps).

  1. Uninstall/Reinstall Android SDK to folder off of C: (no spaces in path)
  2. Re-create the AVD.
  3. Set the PATH environment variable for the new Android SDK folder locations
  4. Uninstall/reinstall the Android ADT Plugin in Eclipse.
  5. Configure the Android SDK location in Eclipse.
  6. Reboot (to reduce the CPU utilization)
  7. Run the emulator from the command line and set it to use all CPUs with High or "Real Time" priority. Make note of your CPU usage.
  8. Open Eclipse and run the app.

Details
I spent two days getting the emulator to run the HelloAndroid app. In my case the problem might have been a combination of an issue with the Android SDK installation and a CPU performance problem. I think something was causing the emulator to run extremely slowly making the emulator appear to hang. My PC is a my Windows 7 64-bit 6GB Intel i7 multi-core PC. Task Manager shows 8 CPUs on my PC on the Performance tag.

My symptom was the Android 2.2 AVD in the emulator appeared to hang when the nimated "Android" text was showing on the screen. The Home screen would never show up. This scenario happened over and over. I would often wait 30 minutes or 45 minutes to no avail.

My environment:

  • Android SDK Revision 12
  • Android 2.2 AVD
  • Windows 7 64-bit
  • Eclipse IDE for Java Developers Indigo Release Build id 20110615-0604
  • Intel Core i7 multi-core CPU, 6 GB, 1.6 GHz

I tried starting the emulator from the command line without starting Eclipse at the command prompt and that didn't help. The emulator still hung. I noticed that Task Manager showed my box at 50% CPU usage which seemed rather high. CPU 0 was pegged at 100%.

Here's what fixed it.

I uninstalled the Android SDK R12 and reinstalled it off the root of C: at C:android-sdk. I had previously experienced problems because the Android SDK was located at "C:Program Files" folder; the SDK has a bug that can't handle the space in the path. I ran "uninstall.exe" from the Android SDK folder to do the uninstall. Uninstalling took longer than installing.

I added ";C:android-sdkools;C:android-sdkplatform-tools" to the PATH environment variable.

I then deleted the AVD using SDK Manager and recreated it.

I uninstalled the ADT Plugin for Eclipse, restarted Eclipse, then reinstalled the ADT Plugin, then closed Eclipse.

I reconfigured Eclipse with the new Android SDK path (Window > Preferences > Android > SDK Location).

On the Task Manager Processes tab, I enabled "Show processes from all users". I then right clicked "emulator-arm.exe *32", then clicked "Set Affinity..." and noticed that the emulator was set to only use CPU 0 so I changed it to use all CPUs. I also set the emulator to "Real Time" priority.

Observing a 50% CPU Usage, I rebooted.

After rebooting, I started the emulator using the command line:

emulator @Android22

Android22 is the name of my AVD. I used task manager to set the affinity for the emulator to use all CPUs and set the priority to high. My CPU usage was now about 13%, mostly due to the emulator. The emulator took about 3 minutes to show the Home screen. Yay!

I then opened Eclipse with the HelloAndroid app and the app successfully ran in the emulator.

I have written out in detail what I did because the past two days have been a real pain. I noticed several posts about this issue with many people not seeming to have success. I performed steps mentioned in several posts but did not find one place that described the whole process.

Good luck. I hope this info helps someone.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...