Java.lang.NoClassDefFoundErro when running test for Android Room
When running a test for a room, I am getting below the exception.
java.lang.NoClassDefFoundError: android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory
My gradle import
//Room
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha3"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
androidTestCompile ("android.arch.persistence.room:testing:1.0.0-alpha3"){
exclude module: 'gson'
}
clean and rebuild don't seem to help.
+3
source to share
1 answer
It shouldn't give an error, but you can try with testCompile, although testCompile also includes compiled production classes by default, it's better to give it one try.
//Room
compile "android.arch.persistence.room:runtime:1.0.0-alpha3"
compile "android.arch.persistence.room:rxjava2:1.0.0-alpha3"
testCompile "android.arch.persistence.room:runtime:1.0.0-alpha3"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3"
androidTestCompile ("android.arch.persistence.room:testing:1.0.0-alpha3"){
exclude module: 'gson'
}
0
source to share