{
  "id": "android/renderscript-rsinvalid-element",
  "signature": "E/RSMessageThread: rsInvalidElement: invalid element at libs/renderscript/rsCpuCore.c:1234",
  "signature_zh": "E/RSMessageThread: rsInvalidElement: 无效元素位于 libs/renderscript/rsCpuCore.c:1234",
  "regex": "rsInvalidElement.*invalid element.*rsCpuCore\\.c",
  "domain": "android",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "RenderScript kernel uses an Element type that is not supported or mismatched with allocation data type.",
  "root_cause_type": "generic",
  "root_cause_zh": "RenderScript 内核使用了不受支持的 Element 类型，或与分配数据类型不匹配。",
  "versions": [
    {
      "version": "Android 12 (API 31)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 13 (API 33)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "RenderScript 24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Change all Element types to F32 in the .rs file",
      "why_fails": "If allocation data is not float, conversion fails silently; may cause wrong results or crashes.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use deprecated rsGetElementAt() instead of rsGetElementAt_type()",
      "why_fails": "Deprecated in API 23+; still compiles but may cause undefined behavior or slower performance.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure Element type in .rs kernel matches Allocation type in Java. Example: In Java, Allocation.createTyped(rs, Type.createXY(rs, Element.F32(rs), w, h)). In .rs, use float *input = rsGetElementAt_type(inputAlloc, x, y);",
      "success_rate": 0.9,
      "how": "Ensure Element type in .rs kernel matches Allocation type in Java. Example: In Java, Allocation.createTyped(rs, Type.createXY(rs, Element.F32(rs), w, h)). In .rs, use float *input = rsGetElementAt_type(inputAlloc, x, y);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Migrate from RenderScript to Android NDK or Vulkan Compute for better support. Rewrite kernels in C++ or GLSL.",
      "success_rate": 0.8,
      "how": "Migrate from RenderScript to Android NDK or Vulkan Compute for better support. Rewrite kernels in C++ or GLSL.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure Element type in .rs kernel matches Allocation type in Java. Example: In Java, Allocation.createTyped(rs, Type.createXY(rs, Element.F32(rs), w, h)). In .rs, use float *input = rsGetElementAt_type(inputAlloc, x, y);",
    "Migrate from RenderScript to Android NDK or Vulkan Compute for better support. Rewrite kernels in C++ or GLSL."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": "rsInvalidElement",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.86,
  "resolvable": "true",
  "first_seen": "2023-08-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}