{
  "id": "android/glsurfaceview-renderer-not-set",
  "signature": "GLSurfaceView: setRenderer has not been called",
  "signature_zh": "GLSurfaceView：尚未调用 setRenderer",
  "regex": "GLSurfaceView.*setRenderer has not been called",
  "domain": "android",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "GLSurfaceView is used without setting a Renderer via setRenderer(), so no OpenGL rendering context is created.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 GLSurfaceView 时未通过 setRenderer() 设置渲染器，因此没有创建 OpenGL 渲染上下文。",
  "versions": [
    {
      "version": "Android 4.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OpenGL ES 2.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "requestRender() requires a renderer to be set; without it, the call is ignored and the error persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "setRenderer() must be called on the main thread; doing so on another thread may cause race conditions or silent failure.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "XML declaration alone does not call setRenderer(); it must be done in code after creating the view.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Call setRenderer() with a valid Renderer implementation in onCreate() or after view initialization",
      "success_rate": 0.95,
      "how": "Call setRenderer() with a valid Renderer implementation in onCreate() or after view initialization",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure the Renderer class implements GLSurfaceView.Renderer and overrides onSurfaceCreated, onDrawFrame, onSurfaceChanged",
      "success_rate": 0.9,
      "how": "Ensure the Renderer class implements GLSurfaceView.Renderer and overrides onSurfaceCreated, onDrawFrame, onSurfaceChanged",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using a custom view, call setRenderer in the constructor after super()",
      "success_rate": 0.85,
      "how": "If using a custom view, call setRenderer in the constructor after super()",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在 onCreate() 或视图初始化后使用有效的 Renderer 实现调用 setRenderer()",
    "确保 Renderer 类实现 GLSurfaceView.Renderer 并重写 onSurfaceCreated、onDrawFrame、onSurfaceChanged",
    "如果使用自定义视图，在构造函数中 super() 之后调用 setRenderer()"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/reference/android/opengl/GLSurfaceView",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}