你好Android模拟器问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2317167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:22:47  来源:igfitidea点击:

HelloAndroid emulator problem

androidandroid-emulator

提问by oriharel

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:

我是第一次尝试 android SDK。我从 HelloAndroid 教程开始。完全遵循每一步,但模拟器在没有我的应用程序的情况下启动。eclipse 控制台说:

[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!

我看到了模拟器,上面有“Android”文字,但没有其他任何反应。有人可以帮忙吗?谢谢!

回答by walkerk

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.
  1. 将 Android SDK 卸载/重新安装到 C:\ 之外的文件夹(路径中没有空格)
  2. 重新创建 AVD。
  3. 为新的 Android SDK 文件夹位置设置 PATH 环境变量
  4. 在 Eclipse 中卸载/重新安装 Android ADT 插件。
  5. 在 Eclipse 中配置 Android SDK 位置。
  6. 重新启动(以降低 CPU 使用率)
  7. 从命令行运行模拟器并将其设置为使用所有具有高或“实时”优先级的 CPU。记下您的 CPU 使用率。
  8. 打开 Eclipse 并运行应用程序。

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.

详细信息
我花了两天时间让模拟器运行 HelloAndroid 应用程序。在我的情况下,问题可能是 Android SDK 安装问题和 CPU 性能问题的组合。我认为某些原因导致模拟器运行非常缓慢,使模拟器看起来挂起。我的 PC 是我的 Windows 7 64 位 6GB Intel i7 多核 PC。任务管理器在我的 PC 上的性能标签上显示 8 个 CPU。

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.

我的症状是当屏幕上显示动画“Android”文本时,模拟器中的 Android 2.2 AVD 似乎挂起。主屏幕永远不会出现。这种场景一遍又一遍地发生。我经常等待 30 分钟或 45 分钟无济于事。

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
  • Android SDK 修订版 12
  • 安卓 2.2 AVD
  • 视窗 7 64 位
  • 面向 Java 开发人员的 Eclipse IDE Indigo 发布版本 ID 20110615-0604
  • Intel Core i7 多核 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%.

我尝试从命令行启动模拟器而不在命令提示符下启动 Eclipse,但这没有帮助。模拟器还是挂了。我注意到任务管理器以 50% 的 CPU 使用率显示我的盒子,这似乎相当高。CPU 0 被固定在 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.

我卸载了 Android SDK R12,然后在 C:\android-sdk 的 C: 根目录下重新安装了它。我之前遇到过问题,因为 Android SDK 位于“C:\Program Files”文件夹;SDK 有一个 bug,无法处理路径中的空间。我从 Android SDK 文件夹运行“uninstall.exe”来执行卸载。卸载比安装花费的时间更长。

I added ";C:\android-sdk\tools\;C:\android-sdk\platform-tools\" to the PATH environment variable.

我在 PATH 环境变量中添加了“;C:\android-sdk\tools\;C:\android-sdk\platform-tools\”。

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

然后我使用 SDK Manager 删除了 AVD 并重新创建了它。

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

我卸载了 Eclipse 的 ADT 插件,重新启动了 Eclipse,然后重新安装了 ADT 插件,然后关闭了 Eclipse。

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

我使用新的 Android SDK 路径(窗口 > 首选项 > Android > SDK 位置)重新配置了 Eclipse。

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.

在任务管理器进程选项卡上,我启用了“显示所有用户的进程”。然后我右键单击“emulator-arm.exe *32”,然后单击“Set Affinity...”并注意到模拟器设置为仅使用 CPU 0,因此我将其更改为使用所有 CPU。我还将模拟器设置为“实时”优先级。

Observing a 50% CPU Usage, I rebooted.

观察到 50% 的 CPU 使用率,我重新启动了。

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!

Android22 是我的 AVD 的名称。我使用任务管理器设置模拟器使用所有 CPU 的亲和力并将优先级设置为高。我的 CPU 使用率现在约为 13%,主要是由于模拟器。模拟器大约需要 3 分钟才能显示主屏幕。好极了!

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

然后我用 HelloAndroid 应用程序打开 Eclipse,该应用程序在模拟器中成功运行。

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.

祝你好运。我希望这些信息可以帮助某人。

回答by Macarse

It's loading. You can check loading progress in logcat from DDMS or adb shell logcat.

正在加载中。您可以从 DDMS 或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.

加载模拟器需要一些时间,但请记住,更新代码时不需要重新启动它。您只需点击Run as...eclipse,它就会负责上传和重新安装到 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!

祝Android开发好运!

回答by AndroidRef.com

And maybe it was just me, but it took me a while to figure out what "LogCat" was that I kept reading about.

也许这只是我,但我花了一段时间才弄清楚我一直在读的“LogCat”是什么。

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.

如果您使用 Eclipse,请执行“窗口/显示视图/其他”。然后在“显示视图”框中键入“LogCat”,然后将显示“Android->LogCat”。选择该选项,您现在将拥有一个显示输出信息的 LogCat 选项卡。您可以使用右上角的“VDIWE”按钮控制显示的信息级别。

回答by Jake

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.

应用上述解决方案后,尝试编辑您的 AVD,将“最大 VM 应用程序堆大小”硬件属性设置为 192 或更高,然后选择 QVGA 皮肤。我遇到了同样的问题,通过这些设置,不到一分钟就加载了 AVD。

回答by Hillie

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"

有同样的问题(卡在加载“home”),让我想起了我遇到的下载问题(卡在 99% 并且没有进一步->(是的,我是一个菜鸟,但它仍然让我想起了这一点) ) 再加上对任何防火墙和病毒防护软件根深蒂固的仇恨,让我产生了一种高能量的狂暴狂怒,它摧毁了与“保护”这个词只有最轻微相似之处的一切

--> emulator worked fine after that!

--> 之后模拟器运行良好!

  • still took 6-7 minutes to load the emulator, but "logcat" can help pass the time :)
  • 加载模拟器仍然需要 6-7 分钟,但“logcat”可以帮助打发时间:)

回答by JosephK

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.

Google SDK 的最后一个工作版本(工具文件夹内容)是 22.3 版,但较旧的工作版本不再在 XML 文件中 ( https://dl-ssl.google.com/android/repository/repository-8。 xml),因此您在 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.

此问题会导致 OP 针对我测试的 19 之前的所有“英特尔”API 版本描述的问题,以及英特尔 API-19 的“浮点异常”。请注意,模拟器的 Arm 版本仍将运行,但如果使用英特尔加速会慢得多。

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:

该问题记录在此线程中,直到尝试 API-19 时我才发现,因此“浮点”错误提供了 google-search 匹配:

https://code.google.com/p/android/issues/detail?id=66786

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).

一种解决方案是 genymotion 的 Virtual Box 实现,尽管它需要一个相当新版本的 glibc,还没有在 Debian stable 或 CentOS 中。(我只花了一天时间安装 OpenSUSE,这样我就可以在找到上述修复程序之前“重新开始工作”)。

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.tgzhttp://dl.google.com/android/android-sdk_r22.3-windows.zip

最快的解决方案是将“工具”(在“android-sdks”文件夹中)重命名为“Broken-tools”,然后下载旧版本,上面的线程中的某个人(以某种方式)位于: 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.

打开 tgz 后,会发现一个填充的“Tools”文件夹,可以将其复制到一个人的“android-sdks”文件夹中,您将旧版本重命名为上面的“Broken-Tools”。

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).

如果这些链接(指向被宣传为“稳定”的非 alpha 版本)应该消失,请注意其他非官方位置存在其他副本(无疑是其他“沮丧”的开发人员试图帮助他们的同伴发布的)。

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.

感谢 Macarse 将我指向“adb shell logcat”,它使我能够找到发生在 19 之前的 API 中的“崩溃循环”,从而创建了“Android Splash Screen Forever”行为,该行为以“SSLCertificateSocketFactory”为中心错误。

回答by user250343

It appears the preferred solution is to buy one of the "Android Dev Phones" as advertised on the Android developer site.

似乎首选的解决方案是购买 Android 开发者网站上宣传的“Android 开发手机”之一。

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.

差不多两年后,模拟器的问题还是一样。在带有最新插件的最新 Eclipse 中,在模拟器崩溃后,CPU 使用率为 30%,被模拟器中的夸张动画消耗。

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.

Eclipse 插件有一个日志视图 LogCat,其中包含将输出保存到文件的选项。该选项会生成一个长度为 0 的文件,其中选择了所有条目。

This is not software. It is something else.

这不是软件。这是别的东西。