android – 在HardwareRenderer createSurface上的IllegalStateException

前端之家收集整理的这篇文章主要介绍了android – 在HardwareRenderer createSurface上的IllegalStateException前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的崩溃日志中,我看到以下错误
java.lang.IllegalStateException eglMakeCurrent Failed EGL_BAD_ALLOC  android.view.HardwareRenderer GlRenderer.createSurface HardwareRenderer.java
       at android.view.HardwareRenderer$GlRenderer.invalidate(HardwareRenderer.java:1328)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1921)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1234)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6467)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
       at android.view.Choreographer.doCallbacks(Choreographer.java:603)
       at android.view.Choreographer.doFrame(Choreographer.java:573)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:157)
       at android.app.ActivityThread.main(ActivityThread.java:5356)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
       at dalvik.system.NativeStart.main(NativeStart.java)

https://github.com/android/platform_frameworks_base/blob/android-4.4_r1.2/core/java/android/view/HardwareRenderer.java#L1328

我为GT I9500 – Android 4.4.2用户发生此事故.
原因是什么,如何隔离问题?

(类似:Problems with passing variable via intent between activities
eglSwapBuffers failed: EGL_BAD_ALLOC AndEngine Android)

解决方法

像你提到的链接一样,第一个寻找错误的地方是确保onPause和onResume被传递给你的超级和GLSurfaceView
...@Override
    protected void onPause() {
        super.onPause();
        mGLView.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mGLView.onResume();
    }

    private GLSurfaceView mGLView;...

猜你在找的Android相关文章