Repository navigation
Fatal Exception: Error loading texture #3
Description
Activity
It occurs when texture can't be generated because of a trashed OpenGL context. One way it can happen when
mTilesFrameLayout.startAnimation()is called aftermTilesFrameLayout.onPause(). Do you work on your own example? If so please check your onResume/onPause calls or share your code if problem persists. If you're getting this error when running provided demo sample then please share more detailed steps and I'll try to reproduce it.ok. I will add some code.
whenmTilesFrameLayout.startAnimation()is called, I will checkmTilesFrameLayout's state ( alreadyonPause()or not )and I will add
try/catchblock like thisif(tiles_frame!=null){ try { tiles_frame.startAnimation(); }catch(Exception e){ finish(); overridePendingTransition(0, 0); } }
I'm working on taking this library and integrating a plugin for NativeScript and I get the same error when I call
.startAnimation()on the instance ofTilesFrameLayoutview. The app isn't pausing so it's likely some app life cycle that NativeScript implements just not certain. I load the view and then on a click (tap) event I get a reference to the view and call.startAnimation()so I'm not sure about onPause() being called.@bradmartin the only was I can reproduce it if I comment out
mTilesFrameLayout.onResume();call in demo app and then go from and back to activity. That would cause GL thread to pause and texture loading would throw an error unless thread will be resumed before that. Can't think of another reason for this crash right now. Could you debug and ensueonResumecall is really happening in right time?@bradmartin the only way I can reproduce it if I comment out
mTilesFrameLayout.onResume();call in demo app and then go from and back to activity. That would cause GL thread to pause and texture loading would throw an error unless thread will be resumed before that. Can't think of another reason for this crash right now. Could you debug and ensueonResumecall is really happening in right time?@mlatu - I've called onResume() and everything seems fine. Can any view be in the layout? I think the bitmap is not being passed correctly to the TextureHelper which is where the
RunTimeExceptionis thrown (line 53).@bradmartin Yes, any view can be in the layout. If there are several views - just wrap it in any
ViewGroup.Exception at line 53 is thrown if
glGenTexturesfailed to do its job. It usually happens when there is no OpenGL context available. At this point it never even tries to work with the bitmap becauseglGenTexturesfails. Could you callint err = GLES20.glGetError(); String msg = GLUtils.getEGLErrorString(err);just before the
throw(afterglGenTextures) and see what's the results?I would do that but I don't have your setup
Working on adding this, android/java are not my specialites so I'm having a time including a forked repo into my project. If I knew the correct way to create a .jar file for this library then I could figure it out but for some reason my .jar files I generate aren't working correctly.
Hello @bradmartin ,so does this worked for you ?
I got error report from this library.
how can I fix or check code?
is this bug?
I thik this error is not appear all time.
some device occur error
Fatal Exception: java.lang.RuntimeException: Error loading texture.
at com.yalantis.starwars.utils.gl.TextureHelper.loadTexture(TextureHelper.java:53)
at com.yalantis.starwars.render.StarWarsRenderer$2.run(StarWarsRenderer.java:290)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1471)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)