. lang。RuntimeException:eglSwapBuffers失败:EGL_SUCCESS

时间:2021-11-01 15:22:48

I've an OpenGL application in the Google Play Store and I'm facing a daily exception:

我在谷歌Play商店有一个OpenGL应用程序,我每天都遇到一个例外:

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1085)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1043)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1369)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

The problem is, on all my smartphones I cannot reproduce this error. I've already contacted Google for any device info, but they have none (so they say). The platform info in the exception is set to "OTHER".

问题是,在我所有的智能手机上,我无法重现这个错误。我已经联系了谷歌的任何设备信息,但是他们没有(所以他们说)。异常中的平台信息被设置为“OTHER”。

I found some hints on the net that this error could be from a Samsung Galaxy Y device, and I found some suggestions to include:

我在网上找到一些提示,说这个错误可能来自三星Galaxy Y设备,我发现了一些建议,包括:

android:configChanges="orientation|screenSize"

in the Android manifest file, but this does not work!

在Android清单文件中,但这不起作用!

And of course I've the onPause and onResume handling implemented for my GL surface which, if not, produces other eglSwapBuffer problems.

当然,我有onPause和onResume处理为我的GL表面实现的,如果没有,就会产生其他eglSwapBuffer问题。

Has anybody a solution for this problem?

有人能解决这个问题吗?

Thanks!

谢谢!

4 个解决方案

#1


11  

No solution, just comment

没有解决方案,只是发表评论

For some reasons I can't comment the previous posts but I've some observations which perhaps could help.

由于某些原因,我不能评论以前的帖子,但我有一些观察可能会有所帮助。

We have the same problem and struggling to find a solution... We drastically reduced the size of our textures and now none is bigger than 1024x900 (don't forget the font ones). But we still need several ones and the problem is still there. We've pinpoint the problematic devices to the following ones:

我们也有同样的问题,并努力寻找解决办法……我们大大减少了纹理的大小,现在没有一个大于1024x900(不要忘记字体)。但是我们仍然需要几个,问题仍然存在。我们已经将问题设备定位到以下几个方面:

Samsung Galaxy Y (GT-S5360 GT-S5360B GT-S5360L GT-S5363 GT-S5368 GT-S5369 SCH-I509 SCH-i509)
Samsung Galaxy Y Duos (GT-S6102 GT-S6102B GT-S6102E ivory)
Samsung Galaxy Ace (GT-S5830 GT-S5830B GT-S5830C GT-S5830D GT-S5830G GT-S5830L GT-S5830M GT-S5830T GT-S5830i GT-S5838 GT-S5839i GT-S6358 SCH-I619 SHW-M240S)
Samsung Galaxy Ace Duos (GT-S6802 GT-S6352 GT-S6802B SCH-I579 SCH-I589 SCH-i579 SCH-i589)
Samsung Galaxy Mini (GT-S5570 GT-S5570B GT-S5570I GT-S5570L GT-S5578 SGH-T499 SGH-T499V SGH-T499Y)
Samsung Galaxy Pocket (GT-S5300 GT-S5300B GT-S5302 GT-S5302B)

Also the error is reported in two flavors with different line numbers:

另外,有两种不同的行数报告了错误:

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1099)
    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1057)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1389)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1085)
    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1043)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1369)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

I don't know if I'm useful here, but in case it helps...

我不知道我在这里是否有用,但万一它有帮助……

#2


6  

Your memory might be not enough to load all data at first. I met that problem too when making my game with AndEngine, too much Atlas with size bigger than 1024x1024 , data might be broken.

您的内存可能不足以在一开始加载所有数据。我也遇到了这个问题,当我用AndEngine制作我的游戏时,太多尺寸大于1024x1024的地图集,数据可能会被破坏。

#3


4  

No solution, just observations.

没有解决方案,只是观察。

The call to eglSwapBuffers returns false. The following error handling does not cope with the case that there is no error -- potentially it has not been set by EGL; OR the return value is wrong.

对eglswapbuffer的调用返回false。下面的错误处理不能处理没有错误的情况——可能它不是EGL设置的;或者返回值是错误的。

I did not find matching sources. These devices either run patched GLSurfaceViews (the stack trace search did not find anything...) or they use an in-between version (well, I don't know if 4.0.2 was official, grepcode contains only 4.0.1 and 4.0.3); OR I've missed something.

我找不到匹配的来源。这些设备要么运行补丁的glsurfaceview(堆栈跟踪搜索没有找到任何东西…),要么使用中间版本(嗯,我不知道4.0.2是正式的,grepcode仅包含4.0.1和4.0.3);或者我已经错过了一些东西。

You have to track down which exact devices/android versions run into this problem. Then you could try to workaround this problem by providing a patched GLSurfaceView yourself, or using a different EGL config -- provided the problem can be fixed at all. There are bugs that are left unhandled for weeks; wondering what greater problems the responsible team faces...

您必须跟踪到底是哪个设备/android版本遇到了这个问题。然后,您可以通过提供一个patched GLSurfaceView,或者使用一个不同的EGL配置来解决这个问题——只要问题可以得到解决。有几周未处理的bug;想知道负责的团队面临的更大的问题是什么……

#4


1  

The solution I ended up implementing was to add a global exception handler to catch this error (since it's thrown outside of any thread I have control over).

我最终实现的解决方案是添加一个全局异常处理程序来捕获这个错误(因为它被抛出到我所控制的任何线程之外)。

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {...})

So at least the application doesn't crash and I can put up a message explaining the situation.

至少应用程序不会崩溃,我可以给你一个解释情况的信息。

#1


11  

No solution, just comment

没有解决方案,只是发表评论

For some reasons I can't comment the previous posts but I've some observations which perhaps could help.

由于某些原因,我不能评论以前的帖子,但我有一些观察可能会有所帮助。

We have the same problem and struggling to find a solution... We drastically reduced the size of our textures and now none is bigger than 1024x900 (don't forget the font ones). But we still need several ones and the problem is still there. We've pinpoint the problematic devices to the following ones:

我们也有同样的问题,并努力寻找解决办法……我们大大减少了纹理的大小,现在没有一个大于1024x900(不要忘记字体)。但是我们仍然需要几个,问题仍然存在。我们已经将问题设备定位到以下几个方面:

Samsung Galaxy Y (GT-S5360 GT-S5360B GT-S5360L GT-S5363 GT-S5368 GT-S5369 SCH-I509 SCH-i509)
Samsung Galaxy Y Duos (GT-S6102 GT-S6102B GT-S6102E ivory)
Samsung Galaxy Ace (GT-S5830 GT-S5830B GT-S5830C GT-S5830D GT-S5830G GT-S5830L GT-S5830M GT-S5830T GT-S5830i GT-S5838 GT-S5839i GT-S6358 SCH-I619 SHW-M240S)
Samsung Galaxy Ace Duos (GT-S6802 GT-S6352 GT-S6802B SCH-I579 SCH-I589 SCH-i579 SCH-i589)
Samsung Galaxy Mini (GT-S5570 GT-S5570B GT-S5570I GT-S5570L GT-S5578 SGH-T499 SGH-T499V SGH-T499Y)
Samsung Galaxy Pocket (GT-S5300 GT-S5300B GT-S5302 GT-S5302B)

Also the error is reported in two flavors with different line numbers:

另外,有两种不同的行数报告了错误:

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1099)
    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1057)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1389)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)

java.lang.RuntimeException: eglSwapBuffers failed: EGL_SUCCESS
    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1085)
    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1043)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1369)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

I don't know if I'm useful here, but in case it helps...

我不知道我在这里是否有用,但万一它有帮助……

#2


6  

Your memory might be not enough to load all data at first. I met that problem too when making my game with AndEngine, too much Atlas with size bigger than 1024x1024 , data might be broken.

您的内存可能不足以在一开始加载所有数据。我也遇到了这个问题,当我用AndEngine制作我的游戏时,太多尺寸大于1024x1024的地图集,数据可能会被破坏。

#3


4  

No solution, just observations.

没有解决方案,只是观察。

The call to eglSwapBuffers returns false. The following error handling does not cope with the case that there is no error -- potentially it has not been set by EGL; OR the return value is wrong.

对eglswapbuffer的调用返回false。下面的错误处理不能处理没有错误的情况——可能它不是EGL设置的;或者返回值是错误的。

I did not find matching sources. These devices either run patched GLSurfaceViews (the stack trace search did not find anything...) or they use an in-between version (well, I don't know if 4.0.2 was official, grepcode contains only 4.0.1 and 4.0.3); OR I've missed something.

我找不到匹配的来源。这些设备要么运行补丁的glsurfaceview(堆栈跟踪搜索没有找到任何东西…),要么使用中间版本(嗯,我不知道4.0.2是正式的,grepcode仅包含4.0.1和4.0.3);或者我已经错过了一些东西。

You have to track down which exact devices/android versions run into this problem. Then you could try to workaround this problem by providing a patched GLSurfaceView yourself, or using a different EGL config -- provided the problem can be fixed at all. There are bugs that are left unhandled for weeks; wondering what greater problems the responsible team faces...

您必须跟踪到底是哪个设备/android版本遇到了这个问题。然后,您可以通过提供一个patched GLSurfaceView,或者使用一个不同的EGL配置来解决这个问题——只要问题可以得到解决。有几周未处理的bug;想知道负责的团队面临的更大的问题是什么……

#4


1  

The solution I ended up implementing was to add a global exception handler to catch this error (since it's thrown outside of any thread I have control over).

我最终实现的解决方案是添加一个全局异常处理程序来捕获这个错误(因为它被抛出到我所控制的任何线程之外)。

Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {...})

So at least the application doesn't crash and I can put up a message explaining the situation.

至少应用程序不会崩溃,我可以给你一个解释情况的信息。