{"record":{"id":"d97411ed4a764c1a","repo":"wasabeef/android-gpuimage","slug":"opengl-es-2-0-is-not-supported-on-this-phone","errorCode":null,"errorMessage":"OpenGL ES 2.0 is not supported on this phone.","messagePattern":"OpenGL ES 2\\.0 is not supported on this phone\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"library/src/main/java/jp/co/cyberagent/android/gpuimage/GPUImage.java","lineNumber":79,"sourceCode":"\n    private final Context context;\n    private final GPUImageRenderer renderer;\n    private int surfaceType = SURFACE_TYPE_SURFACE_VIEW;\n    private GLSurfaceView glSurfaceView;\n    private GLTextureView glTextureView;\n    private GPUImageFilter filter;\n    private Bitmap currentBitmap;\n    private ScaleType scaleType = ScaleType.CENTER_CROP;\n    private int scaleWidth, scaleHeight;\n\n    /**\n     * Instantiates a new GPUImage object.\n     *\n     * @param context the context\n     */\n    public GPUImage(final Context context) {\n        if (!supportsOpenGLES2(context)) {\n            throw new IllegalStateException(\"OpenGL ES 2.0 is not supported on this phone.\");\n        }\n\n        this.context = context;\n        filter = new GPUImageFilter();\n        renderer = new GPUImageRenderer(filter);\n    }\n\n    /**\n     * Checks if OpenGL ES 2.0 is supported on the current device.\n     *\n     * @param context the context\n     * @return true, if successful\n     */\n    private boolean supportsOpenGLES2(final Context context) {\n        final ActivityManager activityManager = (ActivityManager)\n                context.getSystemService(Context.ACTIVITY_SERVICE);\n        final ConfigurationInfo configurationInfo =\n                activityManager.getDeviceConfigurationInfo();","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/wasabeef/android-gpuimage/blob/ceea576ec931c2968431ad46f1fb2e6d68a542e2/library/src/main/java/jp/co/cyberagent/android/gpuimage/GPUImage.java#L61-L97","documentation":"The GPUImage constructor checks whether the device supports OpenGL ES 2.0 (via ActivityManager device configuration info, reqGlEsVersion). On devices lacking GLES 2.0 support it throws IllegalStateException because the whole rendering pipeline (GPUImageRenderer) cannot function.","triggerScenarios":"Instantiating new GPUImage(context) on a device or emulator whose reported OpenGL ES version is below 2.0, or where ActivityManager.getDeviceConfigurationInfo() returns a reqGlEsVersion < 0x20000.","commonSituations":"Very old or unusual devices; emulators without GPU/host-GPU emulation enabled; headless CI emulators; embedded/kiosk hardware; running in an environment where the GPU is disabled (e.g. some x86 emulator images without GPU emulation).","solutions":["Enable GPU/graphics acceleration on the emulator (hardware GLES 2.0) or test on a physical device with GLES 2.0+.","Check support before constructing: use GPUImage's supportsOpenGLES2 logic (ActivityManager device info) and degrade gracefully.","If the device genuinely lacks GLES 2.0, provide a non-GPU fallback image pipeline or refuse to enable GPU-image features."],"exampleFix":"// before\n GPUImage gpuImage = new GPUImage(context);\n// after\n if (supportsOpenGLES2(context)) {\n     GPUImage gpuImage = new GPUImage(context);\n } else {\n     // fall back to non-GL rendering\n }","handlingStrategy":"validation","validationCode":"final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);\nfinal ConfigurationInfo info = am.getDeviceConfigurationInfo();\nboolean gles2Ok = info.reqGlEsVersion >= 0x20000;\nif (!gles2Ok) { /* fallback or disable GPU features */ }","typeGuard":null,"tryCatchPattern":"try {\n    GPUImage gpuImage = new GPUImage(context);\n} catch (IllegalStateException e) {\n    // device lacks OpenGL ES 2.0; enable non-GPU fallback\n}","preventionTips":["Check device GLES support before constructing GPUImage","Enable GPU emulation on test emulators","Test on low-end/older devices in your device matrix"],"tags":["android","gpuimage","opengl","device-compatibility"],"backgroundTag":"unsupported-platform","analyzedSha":"ceea576ec931c2968431ad46f1fb2e6d68a542e2","analyzedAt":"2026-09-11T16:56:13.742Z","contentChangedAt":"2026-09-11T16:56:13.742Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}