Android Code Validator
android_code_validatorValidates Android code (Kotlin, XML, Gradle) for deprecated APIs, Android 16 violations, and structural issues. Returns PASS/WARN/FAIL with line-level violations and fixes.
Instructions
CALL THIS AFTER GENERATING EVERY ANDROID CODE BLOCK. This is the Level 3 loop-back gate: validates AI-generated Kotlin, XML, and Gradle code against 24 Android-specific rules before the user sees it. Detects removed APIs (AsyncTask, TestCoroutineDispatcher), deprecated patterns (ContextualFlowRow, NavController in new code, SharedPreferences), Android 16 violations (orientation locks, resizeableActivity=false), and structural issues (GlobalScope.launch, runBlocking in UI). Returns: verdict (PASS/WARN/FAIL), line-level violations with replacements and doc URLs, and explicit next-step instructions. If verdict is FAIL: fix all errors and re-run before returning code to the user. Inputs: code (required), language ('kotlin'|'xml'|'gradle', auto-detected if omitted), minSdk and targetSdk for context-aware API level checks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The code block to validate | |
| language | No | File type — auto-detected from content if omitted | |
| minSdk | No | App minSdk for API level context (e.g. 24) | |
| targetSdk | No | App targetSdk for API 36 compliance checks (e.g. 36) |