30

Running it from the command line resulted in a segmentation fault:

$ emulator -avd nexus_s
Segmentation fault (core dumped)

However, running emulator-arm directly as follows, works fine.

$ emulator-arm -avd nexus_s

I suspect it's trying to run the mips or x86 version of the emulator. Is there a way to configure the emulator which executable to start?

All this started after updating to android sdk 17.

Adding the -verbose flag gives the following output (which I don't think adds any info):

$ emulator -verbose -avd nexus_s
emulator: found SDK root at /opt/sdk
emulator: Android virtual device file at: /home/grebulon/.android/avd/nexus_s.ini
emulator: virtual device content at /home/grebulon/.android/avd/nexus_s.avd
emulator: virtual device config file: /home/grebulon/.android/avd/nexus_s.avd/config.ini
emulator: using core hw config path: /home/grebulon/.android/avd/nexus_s.avd/hardware-qemu.ini
emulator: Found AVD target API level: 17
emulator: 'magic' skin format detected: 480x800
emulator: autoconfig: -skin 480x800
emulator: autoconfig: -skindir (null)
emulator: keyset loaded from: /home/grebulon/.android/default.keyset
emulator: found magic skin width=480 height=800 bpp=16

emulator: autoconfig: -kernel /opt/sdk/system-images/android-17/armeabi-v7a//kernel-qemu
emulator: autoconfig: -ramdisk /opt/sdk/add-ons/addon-google_apis-google-17/images/armeabi-v7a//ramdisk.img
emulator: Using initial system image: /opt/sdk/add-ons/addon-google_apis-google-17/images/armeabi-v7a//system.img
emulator: autoconfig: -data /home/grebulon/.android/avd/nexus_s.avd/userdata-qemu.img
emulator: autoconfig: -initdata /home/grebulon/.android/avd/nexus_s.avd/userdata.img
emulator: autoconfig: -cache /home/grebulon/.android/avd/nexus_s.avd/cache.img
emulator: Physical RAM size: 343MB

Content of hardware configuration file:
  hw.cpu.arch = arm
  hw.cpu.model = cortex-a8
  hw.ramSize = 343
  hw.screen = touch
  hw.mainKeys = yes
  hw.trackBall = no
  hw.keyboard = no
  hw.keyboard.lid = no
  hw.keyboard.charmap = qwerty2
  hw.dPad = no
  hw.gsmModem = yes
  hw.gps = yes
  hw.battery = no
  hw.accelerometer = yes
  hw.audioInput = yes
  hw.audioOutput = yes
  hw.sdCard = yes
  disk.cachePartition = yes
  disk.cachePartition.path = /home/grebulon/.android/avd/nexus_s.avd/cache.img
  disk.cachePartition.size = 66m
  hw.lcd.width = 480
  hw.lcd.height = 800
  hw.lcd.depth = 16
  hw.lcd.density = 240
  hw.lcd.backlight = yes
  hw.gpu.enabled = yes
  hw.camera.back = none
  hw.camera.front = none
  vm.heapSize = 32
  hw.sensors.proximity = yes
  hw.sensors.magnetic_field = yes
  hw.sensors.orientation = yes
  hw.sensors.temperature = yes
  kernel.path = /opt/sdk/system-images/android-17/armeabi-v7a//kernel-qemu
  kernel.parameters =  android.checkjni=1
  disk.ramdisk.path = /opt/sdk/add-ons/addon-google_apis-google-17/images/armeabi-v7a//ramdisk.img
  disk.systemPartition.initPath = /opt/sdk/add-ons/addon-google_apis-google-17/images/armeabi-v7a//system.img
  disk.systemPartition.size = 200m
  disk.dataPartition.path = /home/grebulon/.android/avd/nexus_s.avd/userdata-qemu.img
  disk.dataPartition.size = 209m
  avd.name = nexus_s
.
QEMU options list:
emulator: argv[00] = "/opt/sdk/tools/emulator64-arm"
emulator: argv[01] = "-android-hw"
emulator: argv[02] = "/home/grebulon/.android/avd/nexus_s.avd/hardware-qemu.ini"
Concatenated QEMU options:
 /opt/sdk/tools/emulator64-arm -android-hw /home/grebulon/.android/avd/nexus_s.avd    /hardware-qemu.ini
emulator: registered 'boot-properties' qemud service
emulator: nand_add_dev: system,size=0xc800000,initfile=/opt/sdk/add-ons/addon-google_apis-google-17/images/armeabi-v7a//system.img
emulator: mapping 'system' NAND image to /tmp/android-grebulon/emulator-RSuUtb
emulator: rounding devsize up to a full eraseunit, now c810000

emulator: nand_add_dev: userdata,size=0xd100000,file=/home/grebulon/.android/avd/nexus_s.avd/userdata-qemu.img
emulator: rounding devsize up to a full eraseunit, now d116000

emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'dalvik.vm.heapsize' = '32m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '240'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'none'
emulator: nand_add_dev: cache,size=0x4200000,file=/home/grebulon/.android/avd/nexus_s.avd/cache.img
emulator: Initializing hardware OpenGLES emulation support
Segmentation fault (core dumped)
grebulon
  • 7,697
  • 5
  • 42
  • 66
  • 1
    OS X? Linux? Some strange parallel-universe version of Windows where they too adopted the `$` command prompt? – CommonsWare Dec 21 '12 at 22:05
  • Linux, ubuntu 12.04 to be specific. – grebulon Dec 22 '12 at 10:56
  • 5
    Try adding `-v` to the `emulator` command line and see where it dumps. I had a problem with `emulator` on the R21 Android tools crashing when trying to load an OpenGL driver on Ubuntu 11.10 -- there's an issue about it on b.android.com, where the workaround is to rename that OpenGL driver so Android can't find it. – CommonsWare Dec 22 '12 at 13:24
  • Before I tried the command-line, the AVD manager would say it is starting the device, but no window would show up. – Nicolas Jul 25 '13 at 03:22

8 Answers8

24

I finally found a solution after following CommonsWare's tip. Renaming libOpenglRender.so made the problem go away.

mv tools/lib/libOpenglRender.so tools/lib/libOpenglRender.so.xxx
grebulon
  • 7,697
  • 5
  • 42
  • 66
  • 4
    This does make the emulator show up. but It outputs the following error message: emulator: ERROR: Could not load OpenGLES emulation library: lib64OpenglRender.so: cannot open shared object file: No such file or directory emulator: WARNING: Could not initialize OpenglES emulation, using software renderer. – Chris.Zou Mar 04 '13 at 05:16
  • THANK YOU VERY MUCH!!! After more than a week trying everything here and there renaming all the lib*.* files from /tools/lib/ to lib*.*.xxx made the emulator to start. I was right, all the emulator crashing issue was related to OpenGLES: https://code.google.com/p/android/issues/detail?id=33336 & https://code.google.com/p/android/issues/detail?id=28601 – warmth Jan 29 '14 at 15:40
  • For 64 bit rename the lib64OpenglRender.so to lib64OpenglRender.so.xxx file. – Amir Habibzadeh Feb 07 '15 at 12:46
  • 1
    When I try this it takes for ever to load the AVD and it's like running it with the ```-gpu off``` option so don't know if it actually solves the problem... anyway we can get it to run fast without using the buggy openGL renderer? – Soroush Apr 17 '15 at 19:03
  • 2
    Don't make the same stupid mistake as me, calling `${ANDROID_HOME}/tools/emulator` instead of `${ANDROID_HOME}/emulator/emulator`. The first one segfaulted on my machine and I wasted some time before I realized the second path was working. – dheuvels Aug 01 '23 at 09:01
4

On my Ubuntu 12.04 system, I solved this problem by making sure "Use Host GPU" was not turned on in the AVD configuration.

lilbyrdie
  • 1,887
  • 2
  • 20
  • 24
4

Paste to ~/.android/avd/.avd/config.ini

hw.gpu.mode = swiftshader_indirect

I solved it this way in my case.

DARUMA
  • 43
  • 1
  • 4
1

I had the same problem on Ubuntu 20.04. Renaming libOpenglRender.so was working for me, but the emulator was taking forever to initialize. Also, I had to reinstall Ubuntu (for different reasons), and then I started getting the emulator: ERROR: Could not load OpenGLES emulation library error when opening the emulator.

After searching more about those issues, I found out that the problem was with the video driver. I was using the Nouveau's, and after changing to an Nvidia driver, I no longer had to keep libOpenglRender.so renamed, and now the emulator initializes very fast without showing any error message.

This is the driver that fixed the issue: enter image description here

Diego Oliveira
  • 459
  • 11
  • 7
0

I had the same problem on Debian Wheezy. The grebulon's answer kind-of worked for me, however the emulator was sloooooow so I set out to fix it The Right Way (tm).

In this case Segmentation fault probably indicates problems with OpenGL. (note that last line of log is "emulator: Initializing hardware OpenGLES emulation support")

In my case, searching for 'GL' through /var/log/Xorg.0.log showed some NVidia GLX driver (from old video card which went to digital heaven). Given the fact that I have AMD Radeon I uninstalled every package with 'nvidia' in it (list: apt-get search nvidia | grep ^i) and installed:

# apt-get install libgl1-fglrx-glx

After reboot emulator complained about missing libOpenglRender.so and libGL.so, which I solved like this:

# echo "/opt/adt/sdk/tools/lib" > /etc/ld.so.conf.d/android_stuff.conf
# ldconfig
# cd /opt/adt/sdk/tools/lib
# ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 libGL.so

Note that my situation is probably unique (problems started when I went from NVidia to AMD), but the root of the problem is probably similar (OpenGL). I hope it helps someone.

UPDATE: still doesn't work, it looks like my drivers do not support 16-bit colors in OpenGL... will investigate further.

johndodo
  • 17,247
  • 15
  • 96
  • 113
0

If you don't find the answer here you should subscribe to:

  1. Issue 34233: Emulator start produces segmentation fault after upgrading to r20
  2. Issue 55325: Emulator crashing with segfault
  3. Issue 20952: Emulator segfault on startup (unrelated to audio)

There you will receive updates about this issue and find some workarounds (like renaming lib*.* files).

warmth
  • 467
  • 6
  • 10
0

wiping data and cold booting device through android studio solved this issue in ubuntu 16.04

Mukundhan
  • 3,284
  • 23
  • 36
-1

Type command

$ emulator-arm @nexus_s

Hope this helps :-)

Arif Ahsan
  • 15
  • 1