我在为Room运行测试时遇到异常。
java.lang.NoClassDefFoundError: android.arch.persistence.db.framework.FrameworkSQLiteOpenHelperFactory
我的gradle进口
//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'
}
清洁和重建似乎没有帮助。
答案 0 :(得分:0)
它不应该提供错误,但您可以尝试使用testCompile,尽管默认情况下testCompile也包含已编译的生产类,但最好还是试一试。
//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'
}