Kotlin tests the use of Android Room, and when calling Room.databaseBuilder in coroutine, it reports an error:
AppDatabase_Impl does not exist
After checking the developer documentation, you can configure it according to the documentation. After thinking deeply, you find that there is a problem with the developer documentation
dependencies {
val room_version = "2.4.3"
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$room_version")
// To use Kotlin Symbol Processing (KSP)
ksp("androidx.room:room-compiler:$room_version")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")
// optional - RxJava2 support for Room
implementation("androidx.room:room-rxjava2:$room_version")
// optional - RxJava3 support for Room
implementation("androidx.room:room-rxjava3:$room_version")
// optional - Guava support for Room, including Optional and ListenableFuture
implementation("androidx.room:room-guava:$room_version")
// optional - Test helpers
testImplementation("androidx.room:room-testing:$room_version")
// optional - Paging 3 Integration
implementation("androidx.room:room-paging:2.5.0-alpha03")
}
The above developer documents give, but when adding dependencies, one dependency is:
kapt("androidx.room:room-compiler:$room_version")
So the problem lies here. There is a dependency of Kapt, but there is no plugin of Kapt
The final solution:
Modify the configuration of app gradle.build to add the plugin kotlin-kapt, as follows:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
Then confirm the three dependency dependencies related to room:
implementation("androidx.room:room-runtime:2.4.3")
annotationProcessor("androidx.room:room-compiler:2.4.3")
kapt("androidx.room:room-compiler:2.4.3")
Read More:
- How to Solve Android jetpack Room Schema export Error
- [Solved] Android Room: Database Common Error ‘missing database’
- How to Solve Jetpack room use error
- org/sqlite/native/Mac/aarch64 Error [How to Solve]
- [Solved] error: package android.support.design.widget does not exist
- TypeError: db.collection is not a function
- [Solved] Error PAM in lightdm startup_ Kwallet (5). So does not exist
- [Solved] Kettle Error: ../deploy does not exist, please create it.
- [Solved] The type or namespace name ‘Service’ does not exist Error
- [Solved] The idea Lombok error: Method does not exist
- Postgres uuid_generate_v1() does not exist [How to Solve]
- [Solved] Lumen Error: Class redis does not exist
- [Solved] Mac Install mongodb error: NonExistentPath: Data directory /data/db not found.
- [Solved] Vscode debug error launch: Program “path” does not exist
- How to Solve Error: Resource’/Servers’ does not exist
- [Solved] No tf data. Actual error: Fixed Frame [world] does not exist
- PostgreSQL insert data error: column “XXX” does not exist solution
- Kotlin: How to Solve kapt import error
- SAP RETAIL Automatic replenishment WRP1R transaction code error: Forecast values for determining target stock do not exist –