HelloAndroid emulator problem
I''m trying andr开发者_如何学Gooid 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!
Summary
(You can see the full details below these summarized steps).
- Uninstall/Reinstall Android SDK to folder off of C:\ (no spaces in path)
- Re-create the AVD.
- Set the PATH environment variable for the new Android SDK folder locations
- Uninstall/reinstall the Android ADT Plugin in Eclipse.
- Configure the Android SDK location in Eclipse.
- Reboot (to reduce the CPU utilization)
- 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.
- 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-sdk\tools\;C:\android-sdk\platform-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.
It's loading. You can check loading progress in logcat from DDMS or adb shell logcat
.
It takes some time to load the emulator, but remember that you don't need to restart it when you update your code. You just hit Run as...
in eclipse and it will take care of uploading and reinstalling into the emu.
Also remember that you can use your phone instead of the emulator. I usually use my phone when the pc I am working on is too slow.
Good luck with Android development!
And maybe it was just me, but it took me a while to figure out what "LogCat" was that I kept reading about.
If you're using Eclipse, do "Window/Show View/Other". Then type "LogCat" into the "Show View" box, and "Android->LogCat" will show up. Pick that option and you'll now have a LogCat tab that displays output info. You can control the level of information displayed with the "VDIWE" buttons in the top right corner.
after appliying above solutions try editing your AVD, set "Max VM application heap size" hardware property to 192 or higher and pick the QVGA skin. I had the same problem, and with these settings the AVD loaded in less than a minute.
Agree with the genius above,
Had the same problem (stuck at loading "home"), reminded me of a download problem i had (stuck at 99% and didn't go any further --> (yeah im a noob, but it still reminded me of that)) and combined with a deeply rooted hate towards any firewall and virus protection software provided me with a high energy berserker rage that destroyed everything that had only the slightest resemblance to the word "protection"
--> emulator worked fine after that!
- still took 6-7 minutes to load the emulator, but "logcat" can help pass the time :)
It appears the preferred solution is to buy one of the "Android Dev Phones" as advertised on the Android developer site.
Almost two years later the emulator problems are still the same. In the latest Eclipse with the latest plugin, after an emulator crash, CPU usage is 30%, consumed by the bombastic animation in the emulator.
The Eclipse plugin has a log view LogCat with an option to save the output to a file. That option produces a 0 length file with all entries selected.
This is not software. It is something else.
For those encountering this thread due to a newer issue, allow me to provide the following. Hopefully it will save folks some days of lost productivity and hair-pulling.
The last working release of Google SDK (Tools folder contents) was version 22.3, yet the older, working versions are no longer in the XML file (https://dl-ssl.google.com/android/repository/repository-8.xml), so you are left with no clear downgrade-path from within the GUI.
This issue causes the issue described by the OP for all "Intel" API-versions prior to 19 which I tested, and a "floating point exception" for Intel API-19. Note that the Arm versions of the emulator will still operate, though much more slowly if one is using Intel-acceleration.
The problem is documented in this thread, which I did not discover until trying the API-19, such that the "floating point" error provided a google-search match:
https://code.google.com/p/android/issues/detail?id=66786
One solution is genymotion's Virtual Box implementation, though it requires a fairly new version of glibc, not yet in Debian stable or CentOS. (I just spent a day installing OpenSUSE so I could "get back to work" before finding the fix, above).
The quickest solution is to rename "Tools" (within the "android-sdks" folder) to "Broken-tools", then download the older version, which someone in the thread, above, located (somehow): http://dl.google.com/android/android-sdk_r22.3-linux.tgz http://dl.google.com/android/android-sdk_r22.3-windows.zip
Upon opening the tgz, one will find a populated "Tools" folder, which can be copied into one's "android-sdks" folder, where you re-named the older version to "Broken-Tools", above.
If those links (to the non-alpha versions promoted as 'stable') should die, note that other copies exist in other unofficial locations, (no doubt posted by other 'frustrated' developers trying to help their fellows out).
Thanks to Macarse, for pointing me to the "adb shell logcat", which enabled me to locate the "crashing loop" which occurs in pre-19 APIs, creating the "Android Splash Screen Forever" behavior, which centers around a "SSLCertificateSocketFactory" error.
精彩评论