I am running an Android Virtual Device on my Ubuntu host.
It is using the CPU/ABI Intel Atom (x86) and I am using the host GPU.
The emulator is using a Kernel-based Virtual Machine.
This works splendidly as long as I use an OpenGL ES2 context.
If my app attempts to create an OpenGL ES3 context however, using...
const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
context = eglCreateContext(display, config, NULL, contextAttribs);
...then I get an EGL_BAD_CONFIG error:
I/biplane ( 2839): EGL: vendor Android version 1.4 Android META-EGL
I/biplane ( 2839): EGL: client apis OpenGL_ES
I/biplane ( 2839): number of EGL configurations that match our preferred criteria: 1
I/biplane ( 2839): R8 G8 B8 A8 DEPTH24
E/EGL_emulation( 2839): tid 2852: eglCreateContext(919): error 0x3005 (EGL_BAD_CONFIG)
Requesting ES3 on a hardware mobile device, works well.
But when requesting it from the emulator, it fails.
The host machine is perfectly capable of doing OpenGL ES3.0, ES3.1 and ES3.2 as can be seen from glxinfo:
$ glxinfo | grep ES3
GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility,
GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility,
GL_NV_ES3_1_compatibility, GL_NV_bindless_multi_draw_indirect,
GL_ARB_ES2_compatibility, GL_ARB_ES3_1_compatibility,
GL_ARB_ES3_2_compatibility, GL_ARB_ES3_compatibility,
GL_NV_ES3_1_compatibility, GL_NV_bindless_multi_draw_indirect,
Is there a way to run OpenGL ES3 apps on an Android Virtual Device on top of kvm?
Running GLES3 apps in the emulator is supported in Android Studio 3.0 and higher.
At the time of writing, preview builds of this version are available.
See: https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html
After launching the emulator, you need to change a setting, and restart the emulator as depicted below.
Also, make sure your app requests an ES3 context, because the Android sample code gles3jni does not do so.
UPDATE jun 2018
In the latest Android Studio, I can no longer select OpenGL ES3.1, even though it is the same PC.
To make it work, I had to add a file to ~/.android/ directory.
cd ~/.android/
$ echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini
Notice :
OpenGL SE should be opened in emulator > Setting > Advanced
Not in the ADB page.
Related
When I try to use USB passthrough as described in https://androidstudio.googleblog.com/2020/08/emulator-30024-canary.html,
emulator -avd Pixel_3a_API_30_x86 -qemu -usb -device usb-host,vendorid=076B,productid=3821
I get the error message 'usb-host' is not a valid device model name. According to the Google link, USB passthrough should be supported from emulator version 30.0.24 and my emulator reports version 30.5.3.0 (build_id 7196367).
Has anyone succeeded in getting this to work?
No! Same with Android emulator version 30.5.4.0 (build_id 7243153).
If I look binary into the Linux version of the qemu emulator file,
I can still find the usb-host option. But it is totally left out
in the Windows Version.
So I guess Google must have switched the usb-host
support in Windows off.
Unfortunately the last Release Notes from the emulator is
from 30.4.5 (February 23, 2021)
Also I can't find any hint about this in the android-review AOSP
Don't know where else to look!?
[Update:]
I think I've found it, on the GitHub AOSP Mirror and android-review AOSP.
From Erwin Jansen committed on 3 Mar:
Revert "Enable usb host redirection for Windows"
# Libusb support on windows is not what we would like it to be
LIBUSB_FLAGS="--disable-libusb --disable-usb-redir"
It looks like the USB Pass Through Feature on Windows was just too buggy.
So, If one would get back to Version 30.5.2 (build_id 7175973) (Feb 27, 2021)
the usb-host will still be a valid device model name.
The DL was taking from a Canary Channel.
But it looks like Google is still working on it...
[Update 10.12.21]
Since Emulator Version 31.1.4 google implemented some new features and tools
to pass USB through.
I couldn't find the -list-usb parameter with emulator -help, but it works
if you run:
emulator -list-usb
VID:PID 058f:6387 (Bus 1, Port 5.1.1)
Manufacturer:
Product:
SerialNumber: 40A0FE0A
With this information, you can use the -usb-passthrough parameter
(-usb-passthrough vendorid=VID,productid=PID[,hostbus=BUS,hostport=PORT])
emulator -netdelay none -netspeed full -avd Pixel_4_API_31 -usb-passthrough vendorid=058f,productid=6387,hostbus=1,hostport=5.1.1
but it shows the error:
ERROR | Cannot load Android USB Assistant Driver for USB device "vendorid=058f". USB pass-through might not work.
Again a new tool Google added, with the prebuilt Windows drivers for USB passthrough one could try it again. Downloadable directly from the AOSP (tgz)
run as admin:
Install_Drivers.bat
Installing Android USB Assistant...
call Android_USB_Assistant_Install.bat
Microsoft PnP Utility
Processing inf : Android_USB_Assistant.inf
Successfully installed the driver.
Driver package added successfully.
Published name : oem89.inf
Total attempted: 1
Number successfully imported: 1
Installing Android Emulator USB Passthrough Assistance Driver
SERVICE_NAME: UsbAssist
TYPE : 1 KERNEL_DRIVER
STATE : 1 STOPPED
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
[SC] DeleteService SUCCESS
SERVICE_NAME: UsbAssist
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 0
FLAGS :
But trying it again, still shows the same error.
[Update 13.12.21]
Now it is working. The correct syntax is with the 0x and without
the usbhost and usbport keyword:
-usb-passthrough vendorid=0x058f,productid=0x6387
It still shows an error message:
qemu-system-x86_64.exe: libusb_kernel_driver_active: -12 [NOT_SUPPORTED]
And the Device is not recognized in the AVD,
but as soon as you root the AVD (Magisk Canary) with my script rootAVD from Github
with the parameters PATCHFSTAB GetUSBHPmodZ
rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-32\google_apis_playstore\x86_64\ramdisk.img PATCHFSTAB GetUSBHPmodZ
and install my usbhostpermissions.zip Magisk Module, an USB drive will
appear as Drive system-wide and an USB Serial Device can be accessed
through a USB Serial Terminal Apk. The APK USB Device Info will also
now show the connected USB Devices. I will update my XDA Guide asap
accordingly.
In order to pass more USB Devices through, just add another one behind the first i.e:
emulator -netdelay none -netspeed full -avd Pixel_4_API_32 -usb-passthrough vendorid=0x058f,productid=0x6387 -usb-passthrough vendorid=0x067b,productid=0x2303
I have been repeatedly trying to get an Android Virtual Device working with Hardware Acceleration on my laptop with a GTX 1650 Ti. The Android Virtual Device works with Swiftshaeder (running with -gpu swiftshader_indirect) with huge lag and running very slowly, but whenever I run it with the gpu, it gives me an error that OpenGLES failed to inialize. My Graphics Card should support OpenGLES, but I can not get it working.
The Error Message:
init: Could not find wglGetExtensionsString! arbFound 0 listarbNull/empty 1 0 extFound 0 extNull/empty 1 0 remote 0
OpenGL Core Profile not supported.
getGLES2ExtensionString: Could not find GLES 2.x config!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
Failed to open /qemu.conf, err: 2
HAX is working and emulator runs in fast virt mode.
emulator: ERROR: OpenGLES emulation failed to initialize. Please consider the following troubleshooting steps:
1. Make sure your GPU drivers are up to date.
2. Erase and re-download the emulator ($ANDROID_SDK_ROOT/emulator).
3. Try software rendering: Go to Extended Controls > Settings > Advanced tab and change "OpenGL ES renderer (requires restart)" to "Swiftshader".
Or, run emulator from command line with "-gpu swiftshader_indirect". 4. Please file an issue to https://issuetracker.google.com/issues?q=componentid:192727 and provide your complete CPU/GPU info plus OS and display setup.
crashhandler_die: fatal: OpenGLES emulation failed to initialize. Please consider the following troubleshooting steps:
1. Make sure your GPU drivers are up to date.
2. Erase and re-download the emulator ($ANDROID_SDK_ROOT/emulator).
3. Try software rendering: Go to Extended Controls > Settings > Advanced tab and change "OpenGL ES renderer (requires restart)" to "Swiftshader".
Or, run emulator from command line with "-gpu swiftshader_indirect". 4. Please file an issue to https://issuetracker.google.com/issues?q=componentid:192727 and provide your complete CPU/GPU info plus OS and display setup.
Note: I know similar questions have been asked, but every solution is saying use Software Encoding. That is not what I am looking for, as Hardware Encoding should work. Software Encoding has terrible performance, and with a dedicated Graphics Card, there should be no issue for hardware encoding, especially with one as modern as the GTX 1650 Ti.
I have an IMX7 board from TechNexion. This is the board linked from the Android Things website as a supported board. On unboxing the board, I cannot connect to the device via Fastboot. I can access the boot prompt and default/shipped linux installation via a serial connection. It also connects via ethernet. But no Fastboot. I'd like to install the latest Android Things OS.
fastboot devices returns nothing. adb devices returns nothing. Rebooting adb has no impact. I've also tried starting Fastboot from the U-Boot prompt.
=> fastboot
Unknown command 'fastboot' - try 'help'
The documentation implies it's installed on the device.
I'm running the latest Android platform tools (26.0.0) on a Mac (10.12.6).
I don't have much experience with Fastboot or hardware, but I have connected to a few other boards without any problem. Any ideas appreciated.
EDIT: below is the output as seen from the serial connection. This is the bootloader output, and then also the initial part of the Linux boot sequence.
MMC: FSL_SDHC: 0, FSL_SDHC: 1
No panel detected: default to MCIMX28LCD
Display: MCIMX28LCD (800x480)
Video: 800x480x24
In: serial
Out: serial
Err: serial
switch to partitions #0, OK
mmc1(part 0) is current device
Net: FEC0
Warning: FEC0 MAC addresses don't match:
Address in SROM is 00:1f:7b:86:2e:3f
Address in environment is 00:1f:7b:aa:01:32
Normal Boot
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1(part 0) is current device
switch to partitions #0, OK
mmc1(part 0) is current device
reading boot.scr
** Unable to read file boot.scr **
reading zImage
5726824 bytes read in 149 ms (36.7 MiB/s)
Booting from mmc ...
reading imx7d-pico_pi.dtb
44004 bytes read in 17 ms (2.5 MiB/s)
Kernel image # 0x80800000 [ 0x000000 - 0x576268 ]
## Flattened Device Tree blob at 83000000
Booting using the fdt blob at 0x83000000
Using Device Tree in place at 83000000, end 8300dbe3
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 4.1.15-224683-gf3ba9d9 (tapani#triceratops) (gcc version 5.1.1 20150608 (Linaro GCC 5.1-2015.08) ) #4 SMP PREEMPT Tue Dec 20 17:50:41 HKT 2016
It looks like your board was not shipped with the fastboot bootloader necessary for Android Things, and instead has been pre-flashed with a Linux distro.
You will need to use the mfgtools package from NXP to re-flash your board with the proper bootloader to continue. The NXP Pico Quick Start Guide for Android Things describes where to get this tool (section 7.3) and how to use it to re-flash the bootloader with mfgtools (section 9.1).
After the bootloader has been updated, you should be able to follow the official flashing instructions to install Android Things using an image downloaded from the console.
Maybe try:
adb kill-server
It helped here Android Things - pico i.mx7 unable to connect
I'm trying to make profiling with simpleperf in my Android ndk application but when I type simpleperf record command, the system reports this message:
simpleperf E 02-08 13:34:47 15380 15380 event_selection_set.cpp:68]
Event type 'cpu-cycles' is not supported by the kernel
I read this tutorial: https://android.googlesource.com/platform/system/extras/+/master/simpleperf/README.md
and I followed these steps:
Make android debuggable=true in the manifest.
adb shell setprop security.perf_harden 0
adb shell
shell#mako: run-as com.mysample.test
adb push bin/android/arm/simpleperf /data/local/tmp
shell#mako: cp /data/local/tmp/simpleperf .
shell#mako: ./simpleperf record -p 12083 --duration 30
Is that means that the nexus 4 cpu-cycles are not supported in the hardware or may i have not activated a specific security flag on the kernel?
I am using rooted nexus 4 device.
Ndk version 13b.
Android version: 5.1
Kernel version: 3.4.0-perf-gf75bb4f
pd: I tagged perf tag because of the similarity with perf.
Thanks in advance.
Unai.
Nexus 4 supports cpu-cycles event. I can't find the kernel version f75bb4f in git history, so I didn't test the same kernel. I have tested by flashing 5.1.1 (LMY48T) on nexus 4, using simpleperf in ndk-r13b, and it works. So I suspect the kernel you use disables perf events, and you can fix this by flashing a new image in https://developers.google.com/android/images#occam.
For the past few days I have been trying to get my Android AVD emulator (from the SDK) working, but none of the solutions posted previously have worked for me. I am running Windows 8.1 Pro, and the IDE I am using is Eclipse Juno. This is the crash report:
Problem signature:
Problem Event Name: APPCRASH
Application Name: emulator-arm.exe
Application Version: 0.0.0.0
Application Timestamp: 543837aa
Fault Module Name: ig4icd32.dll
Fault Module Version: 8.15.10.2555
Fault Module Timestamp: 4e973113
Exception Code: c0000005
Exception Offset: 005612cc
OS Version: 6.3.9600.2.0.0.256.48
Locale ID: 1033
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: 84a0
Additional Information 4: 84a09ea102a12ee665c500221db8c9d6
This happens with every version of Android, every device, from 128-1024MB RAM; I have added libs to PATH, have toggled GPU and snapshot, turned off cameras, edited config.ini file. None of these solutions have worked for me.
UPDATE 1: When running a VirtualBox OpenGL test, VBoxTestOGL.exe crashes with the same fatal module and exception code. Also, Genymotion player.exe crashes on startup, but VirtualBox emulator launches (but cannot user input touches without Genymotion player.exe.
UPDATE 2: Gingerbread AVD I made: http://i.stack.imgur.com/YUXBY.png Also, no info about the AVD in the DDMS console/logs in Eclipse Juno.
UPDATE 3: New Gingerbread AVD according to #ChuongPham 's specifications: http://i.stack.imgur.com/QdtI7.png but still no luck running the emulator. Also, logcat does not even connect to the emulator; it seems like the emulator is terminated before it connects to ADB: http://i.stack.imgur.com/CdZPc.png
UPDATE 4: When running the AVD with the -verbose option, the emulator crashes after logging emulator: Initializing hardware OpenGLES emulation support with all emulated devices.
Android currently does not support JDK v8, you'll need JDK v7 (v7u67). So, to run Android:
Download JDK v7u67 from here. Note: Get the Windows x64 version for Windows 8.
After JDK installation, open your IDE (Eclipse, Android Studio, etc) and direct the IDE to use this new JDK. For example, in Eclipse select Windows | Preferences | Java | Installed JREs and select the JDK installed directory - not the Java Runtime (JRE) directory. The default JDK directory on a Windows computer will be something like "C:\Program Files\Java\jdk1.7.0_67". Note: You can have multiple JDKs installed on a computer, but your IDE must use JDK v7.
IMPORTANT: On Windows, specifying RAM option for an AVD greater than 1MB will not work. The RAM value has to be less than 1MB. Note: 1MB in Windows means 1,024 kilobytes.
UPDATE 1: If your AVD is not started normally, you can try the following commands (repeatedly) to force the ADB server to start:
Type adb kill-server
Then type adb start-server
Then type adb devices
The last command will tell you whether your device is connected to ADB or not. The ADB executable is located at /android-sdk/platform-tools directory.
Also, change the ADB's default timeout to more than five seconds (5000 milliseconds), for example, 30000 milliseconds (30 seconds). In Eclipse, you can access the ADB connection timeout option by going to Windows | Preferences | Android | DDMS.
UPDATE 2: If your AVD still crashed after trying the above fixes, then try this:
For the AVD, change the Device option to use WVGA resolution (less than 1280x800) instead of WXGA. Then, click OK to save the changes.
In Windows, open a command prompt and Run as Administrator.
In the command prompt, navigate to /android-sdk/tools/ directory.
Then type emulator -memory 512 -avd <avd_name>. Note: Substitute <avd_name> with the actual name of the AVD you want to start.
Lastly, if it still doesn't work, then dump the Eclipse Juno + Android bundle and download Eclipse Kepler or Luna separately from here. Then, download the Android SDK separately from here, and ADT here to build a new development environment to test AVD.
BUG: The issue you're facing could also be related to this unresolved Issue 28601.
UPDATE 3:
If you get the emulator: Initializing hardware OpenGLES emulation support error, then try the following fixes:
Add the path of OpenGLES drivers to your System Variable. You can access system variable via Start | Control Panel | System | Advanced System Settings | Environment Variables | Path | Edit and add C:\Program Files\android-sdk\tools\lib to the end of the Variable Value option and press OK to save.
Update the nVidia drivers of your graphic card via Windows Update.
Update the nVidia drivers of your graphic card via nVidia website.
BUG: OpenGLES error could be related to Issue 34233.