Whyt zxing shows black screen in .net maui? - zxing

I'm trying to use the bar code scanning ZXing.Net.Maui from https://github.com/Redth/ZXing.Net.Maui
I add the scanner to a page as follows :
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="myapp.Pages.ControleDesBillets"
x:DataType="viewmodel:StandardPageVM"
xmlns:viewmodel="clr-namespace:myapp.ViewModels"
xmlns:Controls="clr-namespace:myapp.Resources.Controls"
xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI">
<Grid RowDefinitions="*" ColumnDefinitions="*">
<zxing:CameraBarcodeReaderView x:Name="cameraBarcodeReaderView" Grid.Column="0" Grid.Row="0" HeightRequest="200" WidthRequest="200"/>
</Grid>
</ContentPage>
When the app runs, it prompts for the Camera Access which is allowed then it shows a black screen and nothing else.
The scanner is initialized in the start up of the app :
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>().UseMauiCommunityToolkit();
builder.UseBarcodeReader(); // << here
return builder.Build();
}
I'm testing using a physical device. Here is my output :
Loaded assembly: /data/data/com.companyname.myapp/files/.__override__/Xamarin.Google.Guava.ListenableFuture.dll [External]
[CameraManagerGlobal] Connecting to camera service
[CameraManagerGlobal] [soar.cts] ignore the status update of camera: 2
[CameraManagerGlobal] [soar.cts] ignore the status update of camera: 3
[CameraManagerGlobal] [soar.cts] ignore the status update of camera: 4
[CameraManagerGlobal] [soar.cts] ignore the status update of camera: 5
[CameraManagerGlobal] ignore the torch status update of camera: 3
[CameraManagerGlobal] ignore the torch status update of camera: 4
[CameraMetadataJV] setAppNameAndSensorId all [com.antutu:0,ssize,12032x9024,0,false]
[CameraMetadataJV] setAppNameAndSensorId all [com.antutu:1,ssize,5184x3880,0,false]
[CameraRepository] Added camera: 0
[Camera2CameraInfo] Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_3
[CameraRepository] Added camera: 1
[Camera2CameraInfo] Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_3
[CameraValidator] Verifying camera lens facing on rain, lensFacingInteger: null
Thread finished: <Thread Pool> #2
Thread finished: <Thread Pool> #4
Le thread 0x2 s'est arrêté avec le code 0 (0x0).
Le thread 0x4 s'est arrêté avec le code 0 (0x0).
[CompatibilityChangeReporter] Compat change id reported: 150939131; UID 10378; state: ENABLED
Does anyone know what am I doing wrong please ?
Thanks.
Cheers,

Its a known issue : https://github.com/Redth/ZXing.Net.Maui/issues/7
Zxing be it XF or MAUI has always been trash. It's either slow, low performant or has random issues and almost no good features.
There is another BarcodeScanner based on MLKit that's the literal opposite of what I mentioned above.
Installation Steps here: https://github.com/JimmyPun610/BarcodeScanner.Mobile/wiki/3.-Installation-for-Maui
Once you have installed it and have the basic setup ready all you have to do is something like below:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SampleApp.Maui.Page1"
xmlns:gv="clr-namespace:BarcodeScanner.Mobile.Maui;assembly=BarcodeScanner.Mobile.Maui"
Title="Page1">
<ContentPage.Content>
<!--VirbationOnDetected: Indicate the device will vibrate or not when detected barcode, default is True
TorchOn: Indicate the torch will on or not when the view appear, default is False
IsScanning : Indicate whether the device will start scanning after it is opened, default is True
RequestedFPS: Affect Android only, remove it if you want a default value (https://developers.google.com/android/reference/com/google/android/gms/vision/CameraSource.Builder.html#public-camerasource.builder-setrequestedfps-float-fps)
ScanInterval: Scan interval for iOS, default is 500ms and the minimum is 100ms, please be reminded that double scanning may be occurred if it is too small
-->
<gv:CameraView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" OnDetected="CameraView_OnDetected" Grid.Row="1"
TorchOn="False" VibrationOnDetected="False" ScanInterval="50" x:Name="Camera"/>
</ContentPage.Content>
</ContentPage>
And you are done. Hope this helps!

When I push page with camera view, wrapped in NavigationPage, then it freezes.
await Shell.Current.Navigation.PushModalAsync(new NavigaionPage(new ScannerPage), false);
But pushing page by itself works fine no problems
await Shell.Current.Navigation.PushModalAsync(new ScannerPage(), false);

Related

Flutter_downloader HardCrash on Android immediately after download start

Can anyone explain me what's going wrong. I am trying for two days but unable to solve, the app is crashing again and again. Download was working normally, but after adding a new page,just to add new download, the app crashed, and even after deleting the page also it continued crashing.
First crash: No information, sudden disconnect.
Second crash:
D/EgretLoader(28378): EgretLoader(Context context)
D/EgretLoader(28378): The context is not activity
W/WM-WorkSpec(28378): Backoff delay duration less than minimum value
D/DownloadWorker(28378): DownloadWorker{url=https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,filename=Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,savedDir=/storage/emulated/0/Download,header=,isResume=false
D/DownloadWorker(28378): Update notification: {notificationId: 1, title: Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf, status: 2, progress: 0}
D/DownloadWorker(28378): Open connection to https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf
I/com.mcd.twb(28378): Background concurrent copying GC freed 23356(1592KB) AllocSpace objects, 90(3MB) LOS objects, 49% free, 5MB/10MB, paused 19.531ms total 75.666ms
W/ContentCatcher(28378): Failed to notify a WebView
E/libEGL (28378): call to OpenGL ES API with no current context (logged once per thread)
I/flutter (28378): Fatal: could not find callback
E/libEGL (28378): validate_display:92 error 3008 (EGL_BAD_DISPLAY)
I/chatty (28378): uid=10621(com.mcd.twb) RenderThread identical 3 lines
E/libEGL (28378): validate_display:92 error 3008 (EGL_BAD_DISPLAY)
F/OpenGLRenderer(28378): Failed to set damage region on surface 0x79eadeef00, error=EGL_BAD_DISPLAY
Lost connection to device.
Rest of the crashes:
D/DownloadWorker(32459): DownloadWorker{url=https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,filename=Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf,savedDir=/storage/emulated/0/Download,header=,isResume=false
D/DownloadWorker(32459): Update notification: {notificationId: 1, title: Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf, status: 2, progress: 0}
D/DownloadWorker(32459): Open connection to https://bppimt.ac.in/nu/Notice/Notice_on_Postponement_of__scheduled_examinations_on_17.03.2021.pdf
I/com.mcd.twb(32459): NativeAlloc concurrent copying GC freed 22912(1545KB) AllocSpace objects, 82(2MB) LOS objects, 49% free, 5MB/10MB, paused 116us total 227.920ms
I/flutter (32459): Fatal: could not find callback
Lost connection to device.
Answering my own question. The problem is finally solved, it was the problem with my code. Actually I have created the new page outside the main channel. So it was not properly initialized. Now it is working fine.
If someone facing same issue, application get crash immediately after starting download.
Then please ensure that you've register the download callback, check it #445
For anybody experiencing this issue, do something like this:
initFlutterDownloader() async {
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to
console
);
}
then paste this code in initState in the page you want to download the file from:
initFlutterDownloader();

Unity3D WebGL Headless not rendering

I have posted the same question over Unity's forum, but there hasn't been any answer and thus posting it here, too.
I have been trying to run a Unity WebGL build in headless mode (through puppeteer) while saving 'screenshots' of the game, but the camera rendering doesn't seem to be working. The resulting images are all black.
It works as expected when not in headless mode (but still WebGL).
It also works properly in standalone builds (e.g., windows, mac), through -batchMode.
Here's the code in question:
// Problem seems to be in the following 2 lines
RenderTexture.active = camera.targetTexture;
camera.Render();
// same dimensions, both in headless and not headless
Debug.Log("CAMERA TARGET TEXTURE WIDTH: " + camera.targetTexture.width);
Debug.Log("CAMERA TARGET TEXTURE HEIGHT: " + camera.targetTexture.height);
tempTexture2D = new Texture2D(camera.targetTexture.width, camera.targetTexture.height, TextureFormat.RGB24, false);
tempTexture2D.ReadPixels(new Rect(0, 0, camera.targetTexture.width, camera.targetTexture.height), 0, 0);
tempTexture2D.Apply();
// RGBA(0.000, 0.000, 0.000, 1.000): totally black, when in WebGL headless mode. Works fine otherwise.
Debug.Log(tempTexture2D.GetPixels(100, 100, 1, 1)[0].ToString());
// Encode texture into JPG
byte[] bytes = tempTexture2D.EncodeToJPG();
// byte count is almost half when in headless mode
Debug.Log("IMG " + frameNumber + " byte count: " + bytes.Length);
// save to persistentData (indexedDB in WebGL)
// that data is then read on client side and encoded again
I found some differences between the Webgl headfull and headless versions (respective pictures below).
I have also tried to set --use-gl=swiftshader which has better gpu stats, but still shows everything in black:
To be clear, the arguments I'm passing to chromium are the following:
args:[
'--headless',
'--hide-scrollbars',
'--mute-audio',
'--no-sandbox',
'--use-gl=swiftshader' // tested with and without
]
The headless log output coming from unity is the following:
PAGE LOG: Loading player data from data.unity3d
PAGE LOG: Initialize engine version: 2018.4.10f1 (a0470569e97b)
PAGE LOG: Creating WebGL 2.0 context.
PAGE LOG: Renderer: WebKit WebGL
PAGE LOG: Vendor: WebKit
PAGE LOG: Version: OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))
PAGE LOG: GLES: 3
PAGE LOG: EXT_color_buffer_float GL_EXT_color_buffer_float EXT_float_blend GL_EXT_float_blend EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic OES_texture_float_linear GL_OES_texture_float_linear WEBGL_compressed_texture_etc GL_WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 GL_WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info GL_WEBGL_debug_renderer_info WEBGL_debug_shaders GL_WEBGL_debug_shaders WEBGL_lose_context GL_WEBGL_lose_context
PAGE LOG: OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle 1
PAGE LOG: UnloadTime: 0.340000 ms
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_OPERATION : glFramebufferTexture2D: <- error from previous GL command
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_OPERATION : GetShaderiv: <- error from previous GL command
PAGE LOG: WebGL: INVALID_OPERATION: renderbufferStorageMultisample: samples out of range
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glClear: framebuffer incomplete
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawElements: framebuffer incomplete
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glDrawArrays: framebuffer incomplete
PAGE LOG: [.WebGL-0x7fcdb69e1600]GL ERROR :GL_INVALID_FRAMEBUFFER_OPERATION : glBlitFramebufferCHROMIUM: framebuffer incomplete
Could the problem be the WebGL hardware acceleration altogether? Can I disable it from my WebGL build?
This issue seems to be related with: Rendering WebGL image in headless chrome without a GPU
But that seems to be working properly, at least under MacOS:
https://github.com/Apidcloud/WebGLHeadlessRendering
So I'm still assuming it has something to do with Unity3D. Even if headfull, it will become black when using swift shader, with the only gpu stats difference being video decode--hardware acceleration disabled:
Thanks!
Edit with answer (more details on the actual answer below):
It finally works by disabling the anti-aliasing in unity, which seems to throw some OpenGL errors. Works with and without swift shader.
After 2 or 3 days struggling with this and trying to find the exact problem, it finally works by disabling the anti-aliasing in unity, which seems to throw some OpenGL errors.
That said, the Unity3D WebGL rendering works headlessly (through chromium and puppeteer) even without swift shader, though that is probably what you want for no-gpu scenarios (e.g., some server).
The log output, though still weird, for both scenarios (with and without swift shader) is the following (note that the framebuffer incomplete errors are gone):
PAGE LOG: [.WebGL-0x7f842a0f6400]GL ERROR :GL_INVALID_OPERATION : glFramebufferTexture2D: <- error from previous GL command
PAGE LOG: [.WebGL-0x7f842a0f6400]GL ERROR :GL_INVALID_OPERATION : GetShaderiv: <- error from previous GL command
Thanks!

Protractor Failed: element not interactable

I am running an E2E test for an Angular 7.x app. The test runs straight forward on my local machine. But when I push it on the repo (GitLab), then pipeline fails and throws following error:
USER PROFILE - Check and change PROFILE
- Failed: element not interactable
(Session info: chrome=71.0.3578.80)
(Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.74-coreos x86_64)
Test Case:
it('USER PROFILE - Check and change PROFILE', () => {
page.navigateTo();
browser.sleep(1000);
expect(page.getProfileEditTagName()).toMatch('app-edit-profile');
expect(element(by.className('logged-as')).getText()).toBe( testEmail );
browser.actions().mouseMove( element.all( by.id('editIcon-salutation') ).get(0)).click().perform().then(function () {
browser.sleep(4000);
element( by.className('mat-select-arrow') ).click().then(function () {
browser.actions().mouseMove( element.all(by.className('option-value mat-option')).get(0)).click().perform();
browser.sleep(1000);
browser.actions().mouseMove( element.all( by.id('saveButton-salutation') ).get(0)).click().perform();
browser.sleep(1000);
});
});
});
navigateTo() is just a method in profile.po.ts:
navigateTo() {
browser.get('/profileComponentUrl');
}
What's confusing me and where I even can't localize the bug or what's wrong, is that it works fine locally. But once I push to repo, then it fails exactly at that test case. Any Hint please?
The reason element is not interactable could be - performing an action on hidden or obscured element.
You can try -
1. add sleep after by.className('mat-select-arrow') ).click(), as I can see you have not added any waits there.
2. Try to check if you running the test on your local and Jenkins machine with same screen resolution. (this could be the reason of obscured element)
I'd recommend to:
Enable the stacktrace in protractor config: new SpecReporter({ spec: { displayStacktrace: true } }) so you can see exactly what element is throwing the error. This won't solve it but at least should point you in the right direction.
Then if you're using tabs, buttons or other elements that hide/show/disable/enable or change the DOM view, you add a browser.sleep(100) after calling a .click()
I had a same kind of problem and I found this.
I copy pasted that (and some other minor tweaks for example force clicking on previous page in for-loop) and it worked. I believe that the browser.driver.manage().window().maximize(); was part of the solution.
One reason which i figure out is the scroll issue. You need to check the element is displaying properly or not. It may be hidden. So use scrollToTop/scrollToElement/scrollToElementView etc. You can write different scroll methods which suites the condition better.
Another reason is the locator. Try to change the locator, do not trim the locator too much. Just try with full body css locator, if it works then trim properly. Some time in chrome console it may work but not with the test case.

Android Things GpioCallback not received

I am trying to implement the button sample from simplepio. I have made the connection as shown in schematics. After pressing the button I do not get the GPIO callback.
Code I am using is same as that of sample. There are no exceptions only "Starting Activity" gets print in log
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "Starting ButtonActivity");
PeripheralManagerService service = new PeripheralManagerService();
try {
String pinName = BoardDefaults.getGPIOForButton();
mButtonGpio = service.openGpio(pinName);
mButtonGpio.setDirection(Gpio.DIRECTION_IN);
mButtonGpio.setEdgeTriggerType(Gpio.EDGE_FALLING);
mButtonGpio.registerGpioCallback(new GpioCallback() {
#Override
public boolean onGpioEdge(Gpio gpio) {
Log.i(TAG, "GPIO changed, button pressed");
// Return true to continue listening to events
return true;
}
});
} catch (IOException e) {
Log.e(TAG, "Error on PeripheralIO API", e);
}
}
What I have tried so far:
Verified that the circuit and button are functional by running a
python button program in raspbian jessie with following code
#!/usr/bin/env python
import os
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
if (GPIO.input(21) == False):
print("Button Clicked")
sleep(0.1)
The above code prints "Button Clicked" when button is pressed. So I
am sure that the button and GPIO pins on my PI are not an issue.
To make sure there is no issue with logging I also tried
modifying the original program to contain a TextView and a counter
so as when a button is clicked the counter value is incremented and
displayed in TextView but again the callback wasn't received and
TextView wasn't updated.
Tried different edge trigger type but onGpioEdge is never called.
Following is the picture of my setup
Is it just me or is your resistor in the wrong breadboard row
The arrow shows where it is, the circle shows where it should be.
According to the fritzing diagram:
I found the Button driver to be quite unreliable on the Raspberry PI with Android things, after all the driver is pretty much the same code you have.
However, ButtonInputDriver worked flawlessly.
In fact, you do not need to address the GPIO directly and can use the drivers layers, which is simpler. The button driver is here: https://github.com/androidthings/contrib-drivers/tree/master/cap12xx
I suggest you give ButtonInputDriver a try.
It might be possible that I didn't connect the circuit as per schematics or the resistor might not be making good contact. The best way to debug this is as Dave McKelvie suggested is to measure the voltage using voltmeter.
The reason why the Python code was working because the Raspberry PI 3 has internal pull up resistor which was got used as suggested by Dave McKelvie in the comments.
Another reason that the button might not be working is if the GPIO pin is already being used by another application. The logger show the following error for following scenario
Error on PeripheralIO API
com.google.android.things.pio.PioException: android.os.ServiceSpecificException: BCM21 is already in use
at com.google.android.things.pio.GpioImpl.<init>(GpioImpl.java:53)
at com.google.android.things.pio.PeripheralManagerService.openGpio(PeripheralManagerService.java:169)
at com.example.androidthings.simplepio.ButtonActivity.onCreate(ButtonActivity.java:129)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.ServiceSpecificException: BCM21 is already in use
at android.os.Parcel.readException(Parcel.java:1697)
at android.os.Parcel.readException(Parcel.java:1636)
at com.google.android.things.pio.IPeripheralManagerClient$Stub$Proxy.OpenGpio(IPeripheralManagerClient.java:776)
at com.google.android.things.pio.GpioImpl.<init>(GpioImpl.java:51)
at com.google.android.things.pio.PeripheralManagerService.openGpio(PeripheralManagerService.java:169) 
at com.example.androidthings.simplepio.ButtonActivity.onCreate(ButtonActivity.java:129) 
at android.app.Activity.performCreate(Activity.java:6662) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

OpenGL ES 2.0 Support for Android?

Does the Android emulator support OpenGL ES 2.0? I've seen some people say "Yes, but you have to change a few settings." and I've also seen "No, it doesn't support it, period." Here's what I've done to try and correct the problem, including some error messages that I got.
First, I modified the AndroidManifest.xml to contain the following code:
<uses-feature
android:glEsVersion="0x00020000" />
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
Then, when I want to instantiate my GLSurfaceView, I use this sequence of code to instantiate it:
super(context);
setEGLContextClientVersion(2);
setRenderer(new MyRenderer());
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
Then, everywhere I looked said that you must go into the AVD Manager, select the emulator, go to "Hardware", add "GPU emulation" and set the boolean to "yes". However, here is what I see when I look at mine:
What's peculiar is that I have another emulator in my AVD Manager of which I do have the "Hardware" table:
And just to show you exactly what I'm doing, here's some code that does some stuff I want to do in OpenGL ES 2.0 (I mainly got this from Android's own tutorials):
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
program = GLES20.glCreateProgram();
GLES20.glAttachShader(program, vertexShader);
GLES20.glAttachShader(program, fragmentShader);
GLES20.glLinkProgram(program);
I don't want to change my code back to work with OpenGL ES 1.0 because that will require a lot of headaches and if I can avoid it, I will.
Finally, when I try running my program, the program closes with the window: "Unfortunately, has stopped." This is what LogCat told me:
12-05 06:16:27.165: E/AndroidRuntime(936): FATAL EXCEPTION: GLThread 81
12-05 06:16:27.165: E/AndroidRuntime(936): java.lang.IllegalArgumentException: No config chosen
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:874)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
I can say Yes on your question.
Android emulator supports OpenGL ES 2.0.
I created an app with cocos2d-x v.2 (which uses OpenGL ES 2.0).
I had same FATAL EXCEPTION: GLThread 81 error with same stack.
I solved this issue by adding
gLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
before setting renderer setRenderer:
gLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
Now I can run my app on Android emulator.
See my question and answer at https://stackoverflow.com/a/13719983/307547.
My post on this link contains screenshot with AVD settings:
http://www.cocos2d-x.org/boards/6/topics/12563?r=19274#message-19274
I just fixed the problem without adding any new lines to my source code. In the avd-manager i set "Use Host GPU" for my emulator device. Works now perfectly fine on my Geforce GTX 570.
API Level on emulator device is 16, and min-SDK in Manifest is 15.
Got the same problem. Original Buggy Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(this.getClass().getName(), "Into onCreate Draw triangle");
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
if (detectOpenGLES20()){
Log.d("GLES20", "GL ES 2.0 Supported..............!");
} else {
Log.d("GLES20", "GL ES 2.0 Not Supported...............!");
}
view = new GLSurfaceView(this);
view.setEGLContextClientVersion(2);
view.setEGLConfigChooser(true);
view.setRenderer(new TriangleRenderer(view));
setContentView(view);
}
Solved by :
a.) Replacing this code line
view.setEGLConfigChooser(true);
with
view.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
b.) Setting -gpu on via Eclipse --> Run as ---> Target ---> Additional Emulator Command Line Options
Adding a little more to the above discussion:
There were two different Exception messages I came across while working with the above piece of code
FATAL EXCEPTION: GLThread 75
java.lang.IllegalArgumentException: No configs match configSpec
and
java.lang.IllegalArgumentException: No config chosen
A more detailed case study narrated at http://on-android-opengl2.blogspot.in/2013/05/android-opengl-es-20-emulator.html