1
When trying to run an application developed in Kotlin with ROOM Persistence Library I have the following return:
java.lang.Runtimeexception: cannot find implementation for br.com.androidxexample.Database.Appdatabase. Appdatabase_impl does not exist
The error occurs when trying to run databaseBuilder
val db = Room.databaseBuilder(
applicationContext,
AppDatabase::class.java, "localDB"
).build()
build.Gradle (Module:App)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "br.com.androidxexample"
minSdkVersion 22
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
def room_version = "2.1.0-alpha06"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
}
GITHUB of the Project: https://github.com/tpoderoso/AndroidXExample
Add your project dependencies to the question.
– Leonardo Lima