{"record":{"id":"5944018d817e977b","repo":"libgdx/libgdx","slug":"couldn-t-instantiate-gles20","errorCode":null,"errorMessage":"Couldn't instantiate GLES20.","messagePattern":"Couldn't instantiate GLES20\\.","errorType":"exception","errorClass":"GdxRuntimeException","httpStatus":null,"severity":"critical","filePath":"backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Graphics.java","lineNumber":106,"sourceCode":"\t\t\t\twindow.asyncResized = true;\n\t\t\t}\n\t\t}\n\t};\n\n\tpublic Lwjgl3Graphics (Lwjgl3Window window) {\n\t\tthis.window = window;\n\t\tif (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL32) {\n\t\t\tthis.gl20 = this.gl30 = this.gl31 = this.gl32 = new Lwjgl3GL32();\n\t\t} else if (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL31) {\n\t\t\tthis.gl20 = this.gl30 = this.gl31 = new Lwjgl3GL31();\n\t\t} else if (window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL30) {\n\t\t\tthis.gl20 = this.gl30 = new Lwjgl3GL30();\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tthis.gl20 = window.getConfig().glEmulation == Lwjgl3ApplicationConfiguration.GLEmulation.GL20 ? new Lwjgl3GL20()\n\t\t\t\t\t: (GL20)Class.forName(\"com.badlogic.gdx.backends.lwjgl3.angle.Lwjgl3GLES20\").newInstance();\n\t\t\t} catch (Throwable t) {\n\t\t\t\tthrow new GdxRuntimeException(\"Couldn't instantiate GLES20.\", t);\n\t\t\t}\n\t\t\tthis.gl30 = null;\n\t\t}\n\t\tupdateFramebufferInfo();\n\t\tinitiateGL();\n\t\tGLFW.glfwSetFramebufferSizeCallback(window.getWindowHandle(), resizeCallback);\n\t}\n\n\tprivate void initiateGL () {\n\t\tString versionString = gl20.glGetString(GL11.GL_VERSION);\n\t\tString vendorString = gl20.glGetString(GL11.GL_VENDOR);\n\t\tString rendererString = gl20.glGetString(GL11.GL_RENDERER);\n\t\tglVersion = new GLVersion(Application.ApplicationType.Desktop, versionString, vendorString, rendererString);\n\t\tif (supportsCubeMapSeamless()) {\n\t\t\tenableCubeMapSeamless(true);\n\t\t}\n\t}\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/libgdx/libgdx/blob/97f40861878058087be0685ca167ddfde132134b/backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/Lwjgl3Graphics.java#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nconfig.glEmulation = Lwjgl3ApplicationConfiguration.GLEmulation.ANGLE_GLES20; // class missing at runtime\n\n// after (Gradle)\ndependencies {\n    implementation \"com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion\"\n    implementation \"com.badlogicgames.gdx:gdx-backend-lwjgl3-angle:$gdxVersion\" // same version\n}","handlingStrategy":"try-catch","validationCode":"try {\n    Class.forName(\"com.badlogic.gdx.backends.lwjgl3.angle.Lwjgl3GLES20\", false, Lwjgl3Graphics.class.getClassLoader());\n} catch (ClassNotFoundException e) {\n    System.err.println(\"ANGLE/GLES backend not on classpath; falling back to GL20 emulation\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    new Lwjgl3Application(listener, config);\n} catch (GdxRuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"GLES20\")) {\n        config.glEmulation = Lwjgl3ApplicationConfiguration.GLEmulation.GL20;\n        new Lwjgl3Application(listener, config);\n    } else throw e;\n}","preventionTips":["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."],"tags":["opengl","lwjgl3","angle","gles","classpath","startup","gdx"],"backgroundTag":null,"analyzedSha":"97f40861878058087be0685ca167ddfde132134b","analyzedAt":"2026-08-14T10:52:53.492Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}