Android room persistent AppDatabase_Impl does not exist
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
The AppDatabase_Impl does not exist error in Room means annotation processing did not generate the implementation class. This is usually a build configuration issue, not a runtime Room API problem. Resolving it requires checking dependencies, compiler plugins, and entity or DAO definitions.
Why Generation Fails
Room generates AppDatabase_Impl at compile time. If annotation processing is missing or fails, generated sources are absent and compile errors appear.
Typical causes include:
- Missing kapt or ksp plugin setup.
- Room compiler dependency not added.
- Build failure earlier in entity or DAO annotations.
- Mixed Java and Kotlin setup with inconsistent processors.
Correct Gradle Setup with Kapt
A standard Kotlin setup uses kapt for Room compiler.
Then sync and run a clean rebuild.
Minimal Valid Room Definitions
Make sure database, entities, and DAO signatures are valid.
Any annotation errors here can block generation silently in noisy build logs.
Clean Build and Inspect Generated Sources
After configuration changes, run clean tasks and inspect generated folders.
Check generated source directories for AppDatabase_Impl. If missing, scan build output for Room compiler errors above the final failure line.
KSP Migration Option
If your project uses KSP, do not mix kapt and ksp for the same Room module. Use one consistent processor pipeline.
Consistency in processor setup removes many intermittent generation issues.
Multi-Module Project Checks
In multi-module Android projects, Room processor must be configured in the module where database and entities are compiled. Adding compiler dependency only in app module is not enough if Room classes live in a library module.
Verify plugin and dependencies per module, not globally.
Incremental Build and Cache Issues
Sometimes Gradle cache state hides processor updates. After dependency or plugin changes, run a full clean build and optionally invalidate IDE caches.
This forces regeneration and often resolves stale Impl errors.
KSP-Specific Source Directory Awareness
With KSP, generated sources appear in different directories from kapt. Ensure IDE indexing includes generated paths and that CI compilation tasks run ksp before compile.
If generated code exists but IDE still shows errors, this command helps separate IDE indexing issues from real compile issues.
Preventive Practices
Pin Room version consistently across runtime, ktx, and compiler artifacts. Version mismatches can create confusing errors that look unrelated to generation.
Clear build diagnostics and module-level consistency checks prevent this class of Room setup errors from recurring.
Common Pitfalls
- Adding Room runtime dependency without compiler dependency.
- Enabling kapt plugin but forgetting kapt Room artifact.
- Mixing kapt and ksp in conflicting module configurations.
- Ignoring entity annotation errors that prevent code generation.
- Assuming IDE sync success guarantees annotation processing success.
Summary
AppDatabase_Implis generated at compile time by Room processor.- Fix plugin and compiler dependency configuration first.
- Validate entity, DAO, and database annotations.
- Rebuild cleanly and inspect generated source output.
- Use one processing strategy consistently, either kapt or ksp.

