daniloriso / libgdx-backend-android-livewallpaper

Automatically exported from code.google.com/p/libgdx-backend-android-livewallpaper
0 stars 0 forks source link

Libgdx live wallpaper crash on Samsung i9300 Galaxy s3 #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm working on project related to 3d live wallpaper development.
I'm using libGDX version 0.9.2 and gdx-backend-android-lw.jar for live 
wallpaper implementation.
Opengl version is 1.0
It works good on all devices, but on Samsung i9300 Galaxy S3 (android 4.0.4) my 
app is crashed. I suppose the root cause of this issue is incorrect gl context 
initialization.

Device: Samsung i9300 Galaxy s3

Steps to reproduce:
1. install live wallpaper app on Samsung i9300 Galaxy s3
2. run installed app
3. crash on app initialization

Error log file is attached
Below you can find crash logs:

07-31 13:44:08.305 E/AndroidRuntime(12940): FATAL EXCEPTION: GLThread 1111
07-31 13:44:08.305 E/AndroidRuntime(12940): java.lang.NullPointerException
07-31 13:44:08.305 E/AndroidRuntime(12940): at 
com.badlogic.gdx.backends.android.livewallpaper.AndroidGraphicsLW.setupGL(Androi
dGraphicsLW.java:268)
07-31 13:44:08.305 E/AndroidRuntime(12940): at 
com.badlogic.gdx.backends.android.livewallpaper.AndroidGraphicsLW.onSurfaceCreat
ed(AndroidGraphicsLW.java:311)
07-31 13:44:08.305 E/AndroidRuntime(12940): at 
com.badlogic.gdx.backends.android.livewallpaper.surfaceview.GLBaseSurfaceView$GL
Thread.guardedRun(GLBaseSurfaceView.java:1151)
07-31 13:44:08.305 E/AndroidRuntime(12940): at 
com.badlogic.gdx.backends.android.livewallpaper.surfaceview.GLBaseSurfaceView$GL
Thread.run(GLBaseSurfaceView.java:993)

How can i solve this? 

Thanks

Original issue reported on code.google.com by artempar...@gmail.com on 10 Aug 2012 at 7:35

Attachments:

GoogleCodeExporter commented 8 years ago
Funny, I just ran into this issue myself, the stand alone GLES2 app runs fine, 
but fails when ported to use this live wallpaper backend. On other devices it's 
running fine. 

However, Im getting another error which shows the device is having issues with 
compiling shaders. The SpriteBatch default shader doesn't compile, nor do my 
own shaders. So yes, it may be related to incorrect initialization.

thread start
[16:09] <Josh332> FATAL EXCEPTION: GLThread 1046
[16:09] <Josh332> java.lang.IllegalArgumentException: couldn't compile shader:
[16:09] <Josh332> at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultSha 
der(SpriteBatch.java:225)

Original comment by dvange...@gmail.com on 10 Aug 2012 at 2:16

GoogleCodeExporter commented 8 years ago
Do you know why gl context initialization is incorrect just on Galaxy s3? 
According to logs I didn't detect anything wrong. Do you have any idea to solve 
that?

Original comment by artempar...@gmail.com on 13 Aug 2012 at 4:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I am getting a similar error reported form the S3: -

java.lang.NullPointerException
at 
com.badlogic.gdx.backends.android.livewallpaper.AndroidGraphicsLW.setupGL(Androi
dGraphicsLW.java:254)
at 
com.badlogic.gdx.backends.android.livewallpaper.AndroidGraphicsLW.onSurfaceCreat
ed(AndroidGraphicsLW.java:296)
at 
com.badlogic.gdx.backends.android.livewallpaper.surfaceview.GLBaseSurfaceView$GL
Thread.guardedRun(GLBaseSurfaceView.java:974)
at 
com.badlogic.gdx.backends.android.livewallpaper.surfaceview.GLBaseSurfaceView$GL
Thread.run(GLBaseSurfaceView.java:839)

Unfortunately I don't have access to an S3 to test :(

Original comment by ash.mcco...@gmail.com on 20 Aug 2012 at 8:42

GoogleCodeExporter commented 8 years ago
Hi Folks,

Anoir posted a fix for this on the libgdx forums.

http://badlogicgames.com/forum/viewtopic.php?f=11&t=5042&p=25027#p24967

package com.badlogic.gdx.backends.android.livewallpaper;
class AndroidGraphicsLW

private void setupGL(javax.microedition.khronos.opengles.GL10 gl) {
      if (gl10 != null || gl20 != null)
         return;

      boolean isGL20 = checkGL20();
      Gdx.app.log("AndroidGraphics", "GL20: " + isGL20);

      if (view instanceof GLSurfaceView20) {
         gl20 = new AndroidGL20();
         this.gl = gl20;
      } else {
         gl10 = new AndroidGL10(gl);
         this.gl = gl10;

// comment out the following lines
//         if (gl instanceof javax.microedition.khronos.opengles.GL11) {
//            String renderer = gl.glGetString(GL10.GL_RENDERER);
//            if (!renderer.toLowerCase().contains("pixelflinger")
//                  && !(android.os.Build.MODEL.equals("MB200")
//                        || android.os.Build.MODEL.equals("MB220") || 
android.os.Build.MODEL
//                        .contains("Behold"))) {
//               gl11 = new AndroidGL11(
//                     (javax.microedition.khronos.opengles.GL11) gl);
//               gl10 = gl11;
//            }
//         }
      }

That code seems to deal with REALLY old phones running Android 1.5 and 1.6 
which couldn't run a live wallpaper in any case, so hopefully there shouldn't 
be any problem with commenting them

Original comment by ash.mcco...@gmail.com on 24 Aug 2012 at 9:02