I recently experienced a situation where Android Studio’s emulator crashed when starting an app that performed basic graphics operations.
Crash reason: EXCEPTION_ACCESS_VIOLATION_WRITE Crash address: 0x66720000 Assertion: Unknown assertion type 0x00000000 Process uptime: 13 seconds
I started up Process Monitor to investigate the issue.
Tried recreating the situation, then stopped capturing events with: File -> Capture Events
Wanted to get an overview of the processes involved with: Tools -> Process Tree…
Right clicked studio64.exe and selected: Add process and children to Include filter
Noticed that emulator64-crash-service.exe left a memory dump under:
C:\Users\{user}\.android\breakpad\d16b5760-c4ac-4f06-a3ec-73aa74a70087.dmp
Examined the memory dump with WinDbg (x64).
Checked for details about the crash with:
!analyze -v
Part of the result:
FAULTING_IP: ig9icd64!RegisterProcTableCallback+196cfb 000007fe`c5d9f71b f3410f7f48c0 movdqu xmmword ptr [r8-40h],xmm1 EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 000007fec5d9f71b (ig9icd64!RegisterProcTableCallback+0x0000000000196cfb) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 0000000000000001 Parameter[1]: 000000000ba50000 Attempt to write to address 000000000ba50000 STACK_TEXT: ... : ig9icd64!RegisterProcTableCallback+0x196cfb ... : ig9icd64!RegisterProcTableCallback+0x4a228e ... : ig9icd64!RegisterProcTableCallback+0x4a36b4 ... : ig9icd64!RegisterProcTableCallback+0x4a828d ... : ig9icd64!RegisterProcTableCallback+0x4c52c7 ... : ig9icd64!RegisterProcTableCallback+0x4c500f ... : ig9icd64!RegisterProcTableCallback+0x2ee1a2 ... : lib64GLES_V2_translator!glReadPixels+0x297 ... : lib64OpenglRender+0x364d ... : lib64OpenglRender+0x773b ... : lib64OpenglRender+0x11009 ... : lib64OpenglRender!initLibrary+0x52e3 ... : lib64OpenglRender!initLibrary+0xc4e2c ... : lib64OpenglRender!initLibrary+0x4c7a4 ... : kernel32!BaseThreadInitThunk+0xd ... : ntdll!RtlUserThreadStart+0x1d
This indicated that the problem was related to graphics drivers and/or settings.
I did not have important data on the Android emulator, so I made it boot again by removing all data (including the auto-starting app, which crashed the emulator).
Did this in Android Virtual Device manager with the Wipe Data option.
When the emulator could start again I started looking for additional graphics settings.
Found some under Extended controls -> Settings section -> Advanced tab.
The default setting for OpenGL ES renderer (Autodetect based on host) seemed problematic on this system.
I experimented with the settings and discovered that SwiftShader worked well. Running graphics rendering apps with this setting no longer crashed the emulator.
The problem occurred on a desktop system with an Intel Skylake CPU (Core i7-6700) running Windows 7 using Intel HD Graphics 530 with driver version 21.20.16.4860.
Conclusion
If Android Studio’s emulator crashes when running graphics rendering apps, it may help changing the OpenGL ES renderer setting.