Android Emulator does not work on Ubuntu 16.10 - android-studio

I use an Acer Aspire E1-530 with an Intel 2117U Processor and 6GB of RAM.
I followed the steps given in the React Native Website to install React Native and Android Studio 2.3, and also installed KVM as given in this Ubuntu documentation. Android Studio launches without a problem, and I was successfully able to setup an AVD, but when I launch the AVD, a small window shows up for a brief second and then disappears. I also tried running emulator from ~/Android/Sdk/tools, but it shows this error:
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 55
Current serial number in output stream: 54
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 55
Current serial number in output stream: 54
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 39
Current serial number in output stream: 40
QObject::~QObject: Timers cannot be stopped from another thread
Segmentation fault (core dumped)
When I run emulator-check accl, I get the following output:
accel:
0
KVM (version 12) is installed and usable.
accel

Replace emulator's libstdc++.so with your own:
mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6{,.bak}
mv ~/Android/Sdk/emulator/lib64/libstdc++/libstdc++.so.6.0.18 {,.bak}
ln -s /usr/lib/libstdc++.so ~/Android/Sdk/emulator/lib64/libstdc++/

Run emulator from terminal
$ emulator -use-system-libs -avd YOUR_VIRTUAL_DEVICE_NAME

Related

Failed to initialize Flutter renderer

I am developing my flutter application on linux. But when I run the project I get an error like this:
Starting lib/main.dart in debug mode on Linux...
Creating a Linux application...
Gtk-Message: 20:43:51.812: Failed to load module "canberra-gtk-module"
Gtk-Message: 20:43:51.813: Failed to load module "canberra-gtk-module"
libGL error: MESA-LOADER: unable to open swrast: /usr/lib/x86_64-linux-gnu/libpthread.so.0: version 'GLIBC_PRIVATE' not found (required by /snap/flutter/current/usr/lib/x86_64) -linux -gnu/dri/../../../../lib/x86_64-linux-gnu/librt.so.1) (search paths: /usr/lib/x86_64-linux-gnu/dri: /snap /flutter/current/usr/lib/x86_64-linux-gnu/dri:, suffix _dri)
libGL error: driver failed to load: swrast
(my_project:987): WARNING : 20:43:51.980: Failed to initialize Flutter renderer: Failed to create GL context

I am getting a e/cl error in android studio and need help solving it

I am working in android studio and keep getting this error on run
E/CL_magma: [ERROR] CL_magma - Unable to open shader file 'shaders/gles2.0/Primitive.shaderb'
[ERROR] CL_magma - Unable to open shader file 'shaders/gles2.0/Default.shaderb'
[ERROR] CL_magma - Failed to load texture file 'spot_light_glow.rgba4.tex'
E/CL_magma: [ERROR] CL_magma - Failed to load texture file 'light_flare.rgba4.tex'
A/CL_magma: [FATAL] CL_magma - Couldn't load the default shader.
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 8730 (Thread-440)
I am unsure of how to fix this - can anyone help

libGL error - Unabe to load drivers with OpengGL code in Ubuntu

I just installed PyOpenGL and proceed practice with this tutorial. It starts with this simple code that creates a window:
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
window = 0 # glut window number
width, height = 500, 400 # window size
def draw(): # ondraw is called all the time
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # clear the screen
glLoadIdentity() # reset position
# ToDo draw rectangle
glutSwapBuffers() # important for double buffering
# initialization
glutInit() # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(width, height) # set window size
glutInitWindowPosition(0, 0) # set window position
window = glutCreateWindow("noobtuts.com") # create window with title
glutDisplayFunc(draw) # set draw function callback
glutIdleFunc(draw) # draw all the time
glutMainLoop()
But when I try to run it I get this set of errors:
An error ocurred while starting the kernel
libGL error: unable to load driver: nouveau_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 43
Current serial number in output stream: 42
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 42
Current serial number in output stream: 43
Can someone guide me on what they mean or how to fix them?
There are some discussions on the internet about this issue, but I haven't found one with strong solution. I'm using Ubuntu 16 by the way. Thanks
It seems you have installed some proprietary drivers and after that things got broke. You should uninstall newly installed NVDIA driver and reinstall it. Then on main window go to search application and type additional drivers in that window select driver you installed.
If this doesn't help and you have not installed any additional drivers please type following command on terminal and see if you have this file
》》locate nouveau_dri.so
If it can't find install it and that should fix error.

How do I get a virtual device running after upgrading to ADS 2.3.3?

All was working until I upgraded. But now I can't start a virtual device. This is on Debian Jessie.
I've now wiped everything and reinstalled. I have the same problem: depending on how I configure my virtual device I get either (1) nothing at all or (2) a blank emulated 'phone window and a LOT of errors. See below.
Any suggestions at all as to how to move forward? I've been trying to get this re-installed all day, and nothing.
(NB: I've tried adb kill-server; adb start-server.)
I say I've wiped everything but perhaps I missed something. I completely removed:
* $HOME/Android
* $HOME/AndroidStudioProjects
* $HOME/.android
* $HOME/.AndroidStudio2.3
* $HOME/.gradle
* $HOME/.emulator_console_auth_token
* $HOME/.config/Android Open Source Project
* /usr/local/lib/android_studio (which is where I unzipped the download)
After installing from scratch again, running studio.sh from the command line, then trying to start a virtual device --- here's what I see on the command line:
[ 28819] WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
[ 29831] WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
[ 30843] WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
[ 31854] WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
[ 32888] WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
And here is what I see in ADS's "Android Device Monitor" screen (just the start of a massive rolling list of errors. I have my filter set to show errors only here):
06-28 13:46:54.821 1302-1302/? E/gralloc_ranchu: Could not find software fallback module!?
[ 06-28 13:46:54.821 1302: 1302 E/ ]
connect: failed with fd -1 errno 22
[ 06-28 13:46:54.821 1302: 1302 E/ ]
Failed to connect to host (QemuPipeStream)!!!
06-28 13:46:54.821 1302-1302/? E/gralloc_ranchu: gralloc: Failed to get host connection
[ 06-28 13:46:54.821 1302: 1302 E/ ]
connect: failed with fd -1 errno 22
[ 06-28 13:46:54.821 1302: 1302 E/ ]
Failed to connect to host (QemuPipeStream)!!!
06-28 13:46:54.821 1302-1302/? E/gralloc_ranchu: gralloc: Failed to get host connection
06-28 13:46:54.821 1302-1302/? E/hwcomposer: ranchu_hw_composer hwc_open could not open framebuffer
06-28 13:46:54.822 1302-1302/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x44 in tid 1302 (surfaceflinger)
06-28 13:46:54.822 1302-1302/? A/libc: Unable to open connection to debuggerd: Connection refused
06-28 13:46:55.143 1361-1361/? E/memtrack: Couldn't load memtrack module (No such file or directory)
06-28 13:46:55.143 1361-1361/? E/android.os.Debug: failed to load memtrack module: -2
06-28 13:46:55.188 1361-1361/? E/Minikin: addFont failed to create font /system/fonts/NanumGothic.ttf
06-28 13:46:55.188 1361-1361/? E/Minikin: addFont failed to create font /system/fonts/DroidSansFallback.ttf
06-28 13:46:55.188 1361-1361/? E/Minikin: addFont failed to create font /system/fonts/MTLmr3m.ttf
06-28 13:46:55.248 1361-1361/? E/EmojiFactory_jni: Failed to load libemoji.so: dlopen failed: library "libemoji.so" not found
06-28 13:46:55.458 1361-1361/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-en-us.pat.txt
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-en-us.pat.txt: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207)
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96)
at android.text.Hyphenator.init(Hyphenator.java:154)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207) 
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114) 
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96) 
at android.text.Hyphenator.init(Hyphenator.java:154) 
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207) 
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 
06-28 13:46:55.458 1361-1361/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-eu.pat.txt
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-eu.pat.txt: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207)
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96)
at android.text.Hyphenator.init(Hyphenator.java:154)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207) 
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114) 
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96) 
at android.text.Hyphenator.init(Hyphenator.java:154) 
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207) 
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 
06-28 13:46:55.458 1361-1361/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-hu.pat.txt
java.io.FileNotFoundException: /system/usr/hyphen-data/hyph-hu.pat.txt: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207)
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114)
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96)
at android.text.Hyphenator.init(Hyphenator.java:154)
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207)
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)
at libcore.io.IoUtils$FileReader.<init>(IoUtils.java:207) 
at libcore.io.IoUtils.readFileAsString(IoUtils.java:114) 
at android.text.Hyphenator.loadHyphenator(Hyphenator.java:96) 
at android.text.Hyphenator.init(Hyphenator.java:154) 
at com.android.internal.os.ZygoteInit.preloadTextResources(ZygoteInit.java:207) 
at com.android.internal.os.ZygoteInit.preload(ZygoteInit.java:186) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 
06-28 13:46:55.459 1361-1361/? E/Hyphenator: error loading hyphenation /system/usr/hyphen-data/hyph-hy.pat.txt
You would think that that Could not find software fallback module!? would be something I could google for. But I don't see anything...
I've got this working now.
TL;DR:
DO NOT expect Android Studio to hold your hand WRT the emulator. It will screw up some of the time. It will hide error messages. It might be wise to learn to talk to the emulator directly.
There is a bug in this version of Android Studio -- see this question.
This answer fixes another new bug (at least, new bug for me). It also shows you how to get more control over your virtual devices.
Finding the Actual Errors
First, you need to see the actual error that is causing the emulator to fail. It's likely that Studio is not showing you that; you need to run the emulator directly from the command line. If you have a virtual device called "foo" then this is just emulator #foo, but likely your devices all have names like NEXUS_XL_BLARG_23_SKIDOO. I found it best to rename them to something typeable in the Studio 'AVD' GUI.
If you can't run the emulator command, then you will need to fix your environment variables. I have this in my profile:
export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}/tools/bin
export PATH=${PATH}:/usr/local/lib/jdk/bin
export JAVA_HOME=/usr/local/lib/jdk
(Yes, I have the JDK installed separately. I have no idea whether that is important. Sorry.)
Google's help page for the emulator command is here.
Deal With the 2.3.3 Error
As noted in this question.
emulator #latest_kvm
[139756843472704]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '../emulator/qemu/linux-x86_64/qemu-system-i386': No such file or directory
andy#zarkov[~]%: which emulator
/home/andy/Android/Sdk/tools/emulator
andy#zarkov[~]%: cd /home/andy/Android/Sdk/tools
Deal With the Other Problems You Didn't Know You Had
In my case it turns out that I don't have the right graphic drivers installed to use the emulator with KVM. Now I'm running the emulator from the command line, I can see that. Didn't know before.
andy#zarkov[~/Android/Sdk/tools]%: emulator #latest_kvm
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 36
Current serial number in output stream: 35
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 38
Current serial number in output stream: 39
QObject::~QObject: Timers cannot be stopped from another thread
[1] 30486 segmentation fault emulator #latest_kvm
And it looks as if the goalposts have moved for the software graphic driver and there is another little bug to deal with, which is handled by this SO answer very nicely:
(139) andy#zarkov[~/Android/Sdk/tools]%: emulator #later_soft
ERROR: Invalid GPU mode 'mesa', use one of: on off host guest

Graphics performing bad on Fedora22, error in libGL?

I have problem with graphic on my Fedora system. I see shaking of the window, and that is mostly happening when I scroll through the page, but also I see the error when I want to run MATLAB from command line, I get an error:
libGL error: unable to load driver: r600_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: r600
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
How can I solve this?
Thanks!

Resources