libgdx/libgdx · critical · GdxRuntimeException
Couldn't instantiate GLES20.
Error message
Couldn't instantiate GLES20.
What it means
Lwjgl3Graphics failed to instantiate the GLES20 emulation layer. When glEmulation is ANGLE, gdx reflectively loads com.badlogic.gdx.backends.lwjgl3.angle.Lwjgl3GLES20; any Throwable from Class.forName/newInstance (class missing because the angle backend module isn't on the classpath, static init failure, linkage error) is wrapped in this GdxRuntimeException.
Source
Thrown at backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Graphics.java:106
window.asyncResized = true;
}
}
};
public Lwjgl3Graphics (Lwjgl3Window window) {
this.window = window;
if (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL32) {
this.gl20 = this.gl30 = this.gl31 = this.gl32 = new Lwjgl3GL32();
} else if (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL31) {
this.gl20 = this.gl30 = this.gl31 = new Lwjgl3GL31();
} else if (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL30) {
this.gl20 = this.gl30 = new Lwjgl3GL30();
} else {
try {
this.gl20 = window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL20 ? new Lwjgl3GL20()
: (GL20)Class.forName("com.badlogic.gdx.backends.lwjgl3.angle.Lwjgl3GLES20").newInstance();
} catch (Throwable t) {
throw new GdxRuntimeException("Couldn't instantiate GLES20.", t);
}
this.gl30 = null;
}
updateFramebufferInfo();
initiateGL();
GLFW.glfwSetFramebufferSizeCallback(window.getWindowHandle(), resizeCallback);
}
private void initiateGL () {
String versionString = gl20.glGetString(GL11.GL_VERSION);
String vendorString = gl20.glGetString(GL11.GL_VENDOR);
String rendererString = gl20.glGetString(GL11.GL_RENDERER);
glVersion = new GLVersion(Application.ApplicationType.Desktop, versionString, vendorString, rendererString);
if (supportsCubeMapSeamless()) {
enableCubeMapSeamless(true);
}
}
View on GitHub (pinned to 97f4086187)
Solutions
- Add the matching libGDX ANGLE/GLES backend dependency with the same version as gdx-backend-lwjgl3 (e.g. gdx-backend-lwjgl3-angle / the angle natives packaging).
- If you don't need GLES emulation, leave glEmulation at the default (GL20 or GL30) so Lwjgl3GL20 is used directly.
- Inspect the cause in the stack trace (getCause()) — it names the real reason: ClassNotFoundException, NoClassDefFoundError, or init failure.
- On module-path setups, ensure the angle package is readable (add-opens/requires as appropriate).
Example fix
// before
config.glEmulation = Lwjgl3ApplicationConfiguration.GLEmulation.ANGLE_GLES20; // class missing at runtime
// after (Gradle)
dependencies {
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl3-angle:$gdxVersion" // same version
} Defensive patterns
Strategy: try-catch
Validate before calling
try {
Class.forName("com.badlogic.gdx.backends.lwjgl3.angle.Lwjgl3GLES20", false, Lwjgl3Graphics.class.getClassLoader());
} catch (ClassNotFoundException e) {
System.err.println("ANGLE/GLES backend not on classpath; falling back to GL20 emulation");
} Try / catch
try {
new Lwjgl3Application(listener, config);
} catch (GdxRuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("GLES20")) {
config.glEmulation = Lwjgl3ApplicationConfiguration.GLEmulation.GL20;
new Lwjgl3Application(listener, config);
} else throw e;
} Prevention
- Ship the angle backend artifact with the same gdx version if using GLES emulation.
- Check the cause chain: ClassNotFoundException vs init failure have different fixes.
- Smoke-test startup on a clean machine that mirrors your distribution.
When it happens
Trigger: Configuring Lwjgl3ApplicationConfiguration.glEmulation = GLEmulation.ANGLE_GLES20 (or otherwise non-GL20/30/31/32) without shipping the gdx-backend-lwjgl3-angle (libGDX ANGLE/GLES) artifacts, or on a JVM/module path where that class cannot link.
Common situations: Running desktop with GLES20 emulation for parity with Android; Gradle project missing the angle backend dependency or version mismatch between gdx-backend-lwjgl3 and the angle module; JPMS setups that don't export the angle package; broken static initializer in the GLES20 class.
Related errors
- Couldn't load ANGLE.
- Couldn't initialize GLES
- Couldn't create window
- OpenGL 2.0 or higher with the FBO extension is required. Ope
- OpenGL 2.0 or higher with the FBO extension is required. Ope
AI-assisted analysis of libgdx/libgdx@97f4086187 (2026-08-14).
Data as JSON: /api/errors/5944018d817e977b.
Report an issue: GitHub.