{
  "id": "android/activityresult-api-contract-mismatch",
  "signature": "java.lang.IllegalArgumentException: Can't convert value to Intent, class android.content.Intent is not a valid type",
  "signature_zh": "java.lang.IllegalArgumentException: 无法将值转换为 Intent，类 android.content.Intent 不是有效类型",
  "regex": "IllegalArgumentException.*Can't convert value to Intent.*not a valid type",
  "domain": "android",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "ActivityResultContract expects a different input/output type than the one provided in registerForActivityResult.",
  "root_cause_type": "generic",
  "root_cause_zh": "ActivityResultContract 期望的输入/输出类型与 registerForActivityResult 中提供的不匹配。",
  "versions": [
    {
      "version": "AndroidX Activity 1.7.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 14 (API 34)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kotlin 1.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use ActivityResultContracts.StartActivityForResult() without any type casting",
      "why_fails": "Still throws same error if Input class is not Intent; contract requires explicit type conversion.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove the contract entirely and use deprecated startActivityForResult",
      "why_fails": "Deprecated and won't compile on targetSdk 34+; also breaks modern lifecycle handling.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure the contract matches the input type. For Intent, use ActivityResultContracts.StartActivityForResult() and pass Intent explicitly: registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> ... }",
      "success_rate": 0.9,
      "how": "Ensure the contract matches the input type. For Intent, use ActivityResultContracts.StartActivityForResult() and pass Intent explicitly: registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> ... }",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using custom contract, override createIntent correctly. Example: class CustomContract : ActivityResultContract<Uri, Boolean>() { override fun createIntent(context: Context, input: Uri) = Intent(Intent.ACTION_VIEW, input) }",
      "success_rate": 0.85,
      "how": "If using custom contract, override createIntent correctly. Example: class CustomContract : ActivityResultContract<Uri, Boolean>() { override fun createIntent(context: Context, input: Uri) = Intent(Intent.ACTION_VIEW, input) }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure the contract matches the input type. For Intent, use ActivityResultContracts.StartActivityForResult() and pass Intent explicitly: registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> ... }",
    "If using custom contract, override createIntent correctly. Example: class CustomContract : ActivityResultContract<Uri, Boolean>() { override fun createIntent(context: Context, input: Uri) = Intent(Intent.ACTION_VIEW, input) }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.87,
  "resolvable": "true",
  "first_seen": "2024-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}