# error: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide `room.schemaLocation` annotation processor argument OR set exportSchema to false.

- **ID:** `android/room-schema-export-missing`
- **Domain:** android
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Room database annotation processor requires a schema export directory for migration validation, but it is not configured in build.gradle or exportSchema is set to true without a path.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Room 2.5 - 2.6 | active | — | — |
| Android Gradle Plugin 7.4 - 8.2 | active | — | — |

## Workarounds

1. **Add the following to build.gradle (app-level) for kapt: 'kapt { arguments { arg("room.schemaLocation", "$projectDir/schemas") } }' or for annotationProcessor: 'defaultConfig { javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas"] } } }'** (98% success)
   ```
   Add the following to build.gradle (app-level) for kapt: 'kapt { arguments { arg("room.schemaLocation", "$projectDir/schemas") } }' or for annotationProcessor: 'defaultConfig { javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas"] } } }'
   ```
2. **Set exportSchema = false in the @Database annotation if migration validation is not needed: '@Database(entities = [User::class], version = 1, exportSchema = false)'** (90% success)
   ```
   Set exportSchema = false in the @Database annotation if migration validation is not needed: '@Database(entities = [User::class], version = 1, exportSchema = false)'
   ```

## Dead Ends

- **** — If exportSchema is false, the schema is not exported, but the error may still occur if the processor expects the argument; the build.gradle configuration is still needed. (50% fail)
- **** — The path must be a valid project-relative directory; a wrong path causes the processor to fail silently or create the schema in an unexpected location. (50% fail)
