我只是想在Android上开始开发。 因此,问题是当我试图通过发出命令emulator @A2来启动模拟器时,一个模拟器出现在屏幕上。但即使在等待长达2-3小时后,它所显示的都是黑屏。甚至连Android的主屏幕和logo都没有。只有一个黑屏。而最初“adb设备”显示模拟器为离线。2-3分钟后,所附设备列表变为空白。

我在网上到处搜索,尝试了上面提到的所有步骤,比如杀死并重启adb,在一个没有空格的目录中安装java/android,但都没有用。

我的Jdk和Android安装在以下文件夹中:

C: \ Java32BitInstallation C: \ AndroidSdkInstallation 以下是我下载/安装的内容列表:

Android SDK Tools,修订版13 Android SDK平台工具,修订版10 SDK平台Android 4.0.3, API 15,版本1 Jdk jdk-7u3-windows-i586

在我的路径变量中,我添加了*C:\AndroidSdkInstallation\android-sdk\platform-tools;C:\AndroidSdkInstallation\android-sdk\tools;C:\Java32BitInstallation

同样,在从net中读取后,我添加了JAVA_HOME变量,其值为C:\Java32BitInstallation\但仍然没有使用。

我的系统上同时安装了IntelliJ和Eclipse。但由于启动模拟器,我没有使用任何这些,我不怀疑任何犯规与这些。

我已经尝试了10-12天了,还不能启动模拟器,更不用说编写我的第一个“Hello world”程序了。

Additional notes: My system is a Windows 7 (64 bit) machine. Earlier I had installed 64 bit version of jdk, but the problem was present that time too. Now after searching on internet, I uninstalled that and installed 32 bit version of Java. But, again no use. One thing, though, this 32 bit version of Java (jdk 7 update 3), first install jre as part of jdk installation and then installs jre 7. So now I have 2 folders: jre and jre7 in the C:\Java32BitInstallation directory. Could this have to do anything with my emulator not turning up. Do I need to specify additional environment variables or modify the existing one?

顺便说一句,我有没有提到logcat什么都没有显示。


当前回答

下面是我解决这个问题的方法: 我用下面的命令运行模拟器:

sudo /home/code/Android/Sdk/tools/emulator -avd Nexus_S_API_21 -netspeed full -netdelay none -debug-init -logcat '*:v'

并在输出中收到以下信息:

NAND: could not write file /tmp/android-code/TMP7.tmp, No space left on device. (similar error, could not reproduce it)

所以,我刚刚释放了一些磁盘空间从我的/home目录在ubuntu (windows释放C:驱动器空间),然后它顺利启动。

其他回答

Mac用户:不幸的是,如果你使用的是较旧的Mac(例如2009年底),并且正在使用Yosemite,你不能在64位架构中使用HAXM。根据HAXM的发布说明:

HAXM驱动程序不支持在基于Core微架构(Core, Core2 Duo等)的Intel系统上模拟64位系统映像。支持所有基于Nehalem及以上版本的系统。(Corei3, Core i5和Core i7机器)。

我花了一天的时间试图解决这个问题,然后我看到了这句话。唯一有效的方法是在你的AVD中使用最新操作系统的非x86版本(例如Lollipop Android 5.0.1 armeabi-v7a)

听起来你的设备配置错误。如果你这样做,它将永远不会启动,也不会在Logcat中显示任何东西。

I'd recommend creating a new device using one of the default "Device Definitions" available in the AVD Manager. It's as easy as highlighting the device type you want in the "Device Definitions" tab and clicking the "Create AVD..." button, then filling out a few details. I'd start by adjusting "Internal Storage" to around 8GB and (maybe) an "SD Card" of 2GB while leaving everything else the same. Try starting the device and if you see "Android" pop up onscreen you're running. The first boot usually takes awhile so just hang on and watch Logcat for any issues (the "DDMS" perspective helps here).

如果你仍然看到一个黑屏与默认的设备定义,你有其他地方的问题,导致设备失败。如果是这样的话,挖掘日志可能是你唯一的机会。如果其他方法都不起作用,您总是可以尝试重新下载ADT并重新安装sdk。

这里的目标是让你用一个(非常)基本的设备启动并运行,所以在这一点上不要追求超级出色的配置,只要努力让它运行就可以了。一旦发生这种情况,尝试一个接一个地调整设置,直到你有你喜欢的方式。只要记住模拟器有它的局限性,它不能代替一个真正的设备(尽管它大部分时间都工作;)

同样面对这个问题,试了很多答案,都没有帮助。 最后,以下行动帮助了我:

卸载SDK工具中的HAXM 重新安装HAXM 重新启动电脑 擦除VD数据 冷开机VD

不确定对你是否有帮助,只是作为参考。

更新25.07.2018:

最新的Android Studio版本已经没有这个选项了。 如果问题仍然存在,请尝试在验证配置对话框(如果可用)中的“仿真性能”下拉菜单的值之间切换,或者参考配置模拟器图形渲染和硬件加速。

更新26.02.2014:

在developer.android.com的“配置图形加速”一章中有两个提示。

注意:从SDK Tools修订版17开始,模拟器的图形加速功能还处于实验阶段;在使用此特性时,请注意不兼容和错误。

and

启动AVD管理器并创建一个新的AVD, Target值为Android 4.0.3 (API Level 15),修订版3或更高。

所以Android 4.0.3 (API级别15)似乎是图形加速的最低要求。

原来的答案

我在使用最新的Android SDK时也遇到了同样的问题。

我只是在虚拟设备的设置中取消了“使用主机图形处理器”复选框,它又开始工作了。

“使用主机图形处理器”只适用于我使用Android 4.2作为“目标”。

我把它改为总是“冷启动”来解决我的问题。在此之前,当我运行adb设备时,它总是显示为脱机。