我只是想在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:驱动器空间),然后它顺利启动。

其他回答

我使用微软使用Hyper-V的快速Android模拟器,我创建的每个Android模拟器都有相同的黑屏,无论我如何设置GPU模式(自动,主机,mesa,角度,swiftshader,关闭)。虽然我的情况显然与OP不同,但我认为它可能对那些使用微软Android模拟器的人有用,并在搜索“Android模拟器黑屏”后来到这里。

我的解决方案是更新所有Android工具:

   Visual Studio > Tools > Android > Android SDK Manager > Tools

截至今天(2019-02-01),如果你重新安装了Visual Studio 2017, Android模拟器就会出现黑屏问题。VS会自动显示NuGet包、扩展工具等的更新通知,但不会显示Android工具的更新。您必须手动检查和更新它们。

我在模拟更大的设备(Nexus7和10)时遇到了问题,而手机大小的模拟器工作得很好。在使用平板电脑的几个小时里,屏幕一直是黑屏,什么都没有。真正有帮助的是与这里大多数人推荐的相反:在设置“使用主机GPU”的勾框并将目标设置为最高的android(在撰写本文时为4.4.2)之后,7和10正常工作!

我也有同样的问题。我发现HAXM硬件加速器最近更新了,但没有重新安装,因为更新管理器只是更新了保存在硬盘上的安装程序包。您需要删除HAXM,然后运行安装程序包来完成更新。通常这被安装到android-sdk - root \android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager。android - sdk - root是你的android sdk所在的位置。

也突然有了这个问题。Android工作室占用了100%的CPU,在博览会上我有以下错误:

Couldn't start project on Android: Error running adb: This computer is not authorized to debug the device. Please follow the instructions here to enable USB debugging: https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.

冷启动为我修复了它,就像boltup_im_coding的答案一样。如果它已经在运行(黑屏),也可以用这种方式冷启动。

对我来说,有效的方法是复制设备,然后删除旧设备,并为新设备启动应用程序。不需要更改配置。