【问题标题】:Error "EGL_BAD_MATCH" in Android Studio emulatorAndroid Studio 模拟器中的错误“EGL_BAD_MATCH”
【发布时间】:2016-11-19 20:02:58
【问题描述】:

我有一个问题,那是什么?

E/EGL_emulation: tid 3912: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)

我应该怎么做才能解决这个错误?

public class Main extends AppCompatActivity {

public TextView score;
public ImageView alergator1;
public ImageView alergator2;
public FrameLayout frame;
public int scoreINT;
public float frameHigh;
public float frameWidh;
public float alergator1X;
public float alergator1Y;
public float alergator2X;
public float alergator2Y;
public ImageView miscare;
public int x;

private Handler handler = new Handler();
private static Timer timer = new Timer();



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    score = (TextView) findViewById(R.id.Score);
    alergator1 = (ImageView) findViewById(R.id.runner);
    alergator2 = (ImageView) findViewById(R.id.runner2);
    frame = (FrameLayout) findViewById(R.id.Frame);


    frame.post(new Runnable() {
        @Override
        public void run() {
            frameHigh = frame.getHeight();
            frameWidh = frame.getWidth();
        }
    });

    alergator1.post(new Runnable() {
        @Override
        public void run() {
            alergator1X = frameWidh / 2;
            alergator1.setX(alergator1X);
            alergator1Y = frameHigh - 250;
            alergator1.setY(alergator1Y);
        }
    });


    alergator2.post(new Runnable() {
        @Override
        public void run() {
            alergator2X = frameWidh / 2;
            alergator2.setX(alergator2X);
            alergator2Y = frameHigh - 250;
            alergator2.setY(alergator2Y);
        }
    });


    timer.schedule(new TimerTask() {
        @Override
        public void run() {
            handler.post(new Runnable() {
                @Override
                public void run() {
                    x++;
                    if (x % 2 == 0) {
                        alergator1.setVisibility(View.INVISIBLE);
                        alergator2.setVisibility(View.VISIBLE);
                    } else {
                        alergator2.setVisibility(View.INVISIBLE);
                        alergator1.setVisibility(View.VISIBLE);

                    }

                }
            });

        }
    }, 0, 900);

这是代码,应用程序运行正常,但我想知道发生了什么。可能我的代码比较乱,但是我是初学者。

【问题讨论】:

  • 你需要告诉你当你得到这个错误时你做了什么以及你有什么代码导致这个错误发生
  • stackoverflow.com/questions/28966496/… 没有足够的代表发表评论
  • 欢迎来到 Stack Overflow!我已经编辑了你的问题。您也许可以通过将代码减少到最少的代码来重现错误来改进它,但总的来说这是一个不错的问题。
  • 我在模拟器中看到了同样的问题。就我而言,每当显示 BottomSheetDialog 时,我都会看到这一点。你找到解决方案了吗?

标签: android


【解决方案1】:

EGL 表示模拟图形库。 Android 移动设备操作系统使用 EGL 进行 3D 图形渲染。 从 wiki 获取更多关于 EGL 的知识:https://en.wikipedia.org/wiki/EGL_(API)

当它显示 EGL_BAD_MATCH 时,您/系统选择的仿真图形库是错误的。有两种 EGL 模式,如下图所示。

解决方案:哪个模式有问题,换个模式就好了,应该可以解决的。请注意,在软件仿真模式下运行可能会比在硬件仿真模式设置下运行得慢得多。在某些情况下会抛出错误(显示)但应用程序运行正常。如果是这种情况,您可能希望忽略错误并享受卓越的图形仿真。

【讨论】:

  • Genymotion 模拟器没有这个选项。
  • 我相信谷歌提供的默认 Android 模拟器比 Genymotion 等其他模拟器更负责任。
【解决方案2】:

我也遇到过类似的问题,我尝试了一个简单的示例应用程序,它显示了这个错误。就我而言,我关闭了 android studio 的即时运行功能,它就消失了。我不知道为什么,但你可以试一试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-15
    • 2018-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-27
    • 2018-08-09
    • 2016-09-14
    相关资源
    最近更新 更多