为什么安卓模拟器不能工作

5

几天前我更新了Android Studio,但是Android模拟器停止工作了。我试图打开一个空白活动,但模拟器同样无法工作。

所有的SDK工具都已经被安装和更新。以下是当我运行空白活动(Hello World!)时的事件日志和Logcat。

Event Log: 1/1/2018 4:43 PM Gradle sync started

4:43 PM Project setup started

4:44 PM Gradle sync finished in 34s 677ms

4:44 PM Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]

4:45 PM Gradle build finished in 1m 28s 392ms

5:00 PM Unable to run 'adb': null

5:00 PM 'C:\Media\platform-tools\adb.exe start-server' failed -- run manually if necessary

5:00 PM * daemon not running; starting now at tcp:5037

5:00 PM * daemon started successfully

5:03 PM Executing tasks: [:app:assembleDebug]

5:03 PM Emulator: emulator: ERROR: Missing initial data partition file: C:\Users\Android Studio.android\avd\Nexus_5_API_27.avd/userdata.img

5:03 PM Emulator: compileAndValidateCoreShader: fail to compile. infolog Fragment shader failed to compile with the following errors:

5:03 PM Emulator: ERROR: 0:85: error(#143) Undeclared identifier undefined

5:03 PM Emulator: ERROR: 0:85: error(#132) Syntax error: '<' parse error

5:03 PM Emulator: ERROR: error(#273) 2 compilation errors. No code generated

5:03 PM Emulator:

5:03 PM Emulator: linkAndValidateProgram: fail to link program. infolog: Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.

5:03 PM Emulator:

Logcat: 
01-01 04:05:27.996 3188-3188/com.example.androidstudio.fixit I/zygote: Not late-enabling -Xcheck:jni (already on)
01-01 04:05:28.262 3188-3188/com.example.androidstudio.fixit W/zygote: Unexpected CPU variant for X86 using defaults: x86
01-01 04:05:28.565 3188-3201/com.example.androidstudio.fixit I/zygote: Debugger is no longer active
01-01 04:05:28.915 3188-3188/com.example.androidstudio.fixit I/InstantRun: starting instant run server: is main process
01-01 04:05:29.650 3188-3235/com.example.androidstudio.fixit D/OpenGLRenderer: HWUI GL Pipeline
01-01 04:05:29.872 3188-3235/com.example.androidstudio.fixit I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
01-01 04:05:29.872 3188-3235/com.example.androidstudio.fixit I/OpenGLRenderer: Initialized EGL, version 1.4
01-01 04:05:29.872 3188-3235/com.example.androidstudio.fixit D/OpenGLRenderer: Swap behavior 1
01-01 04:05:29.873 3188-3235/com.example.androidstudio.fixit W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
01-01 04:05:29.873 3188-3235/com.example.androidstudio.fixit D/OpenGLRenderer: Swap behavior 0
01-01 04:05:30.001 3188-3235/com.example.androidstudio.fixit D/EGL_emulation: eglCreateContext: 0xa2b59da0: maj 2 min 0 rcv 2
01-01 04:05:30.073 3188-3235/com.example.androidstudio.fixit D/EGL_emulation: eglMakeCurrent: 0xa2b59da0: ver 2 0 (tinfo 0xac24c670)
01-01 04:05:30.269 3188-3235/com.example.androidstudio.fixit D/EGL_emulation: eglMakeCurrent: 0xa2b59da0: ver 2 0 (tinfo 0xac24c670)

1
删除模拟器,重新开始一个新的怎么样? - Uriel Frankel
我已经尝试了多次。我还尝试使用不同的版本,包括API 27、26和25的模拟器。我还尝试使用不同的手机,主要是Nexus 4、5和5X。 - Klumpted
只是为了澄清,模拟器应用程序已经打开,但它只显示一个空白的白屏,而不是“Hello World!”活动,并且多个错误弹出在侧面。 - Klumpted
1个回答

4
我进入了模拟器中的“设置”->“扩展控制”->“高级”,然后进入“高级”选项,将OpenGL ES渲染器更改为SwiftShader,将OpenGL ES API级别更改为兼容性(OpenGL ES 1.1/2.0),错误似乎已经消失了,屏幕上不再显示白屏,而是显示了谷歌地图,这正是该程序的预期效果。这是否是一个好的解决方案?是否还有其他需要注意的事项,以免在未来出现问题?

从我所读的内容来看,这个问题似乎可能适用于某些较旧的图形卡,我猜编写模拟器代码的人并不关心这些卡片,因此可能会忽略一些东西。我猜在扩展控件中选择这个旧代码可以绕过这个问题? - Greg Kendall
这对我有用,仿真器甚至在此之前都没有显示 Android 主屏幕。 - Sharp Edge

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接