我正在开发一个Android库,并希望在其中使用新的Android Room持久性库.但是,在启动时我收到了这个错误:
Caused by: java.lang.RuntimeException: cannot find implementation for MyLibraryName.Database.QSDatabase. QSDatabase_Impl does not exist
at android.arch.persistence.room.Room.getGeneratedImplementation(Room.java:90)
这意味着annotationProcessor在编译期间不会生成额外的代码.
顺便说一句,当我将@Database代码放在app模块中时,一切正常.
我的gradle文件(库模块):
apply plugin: 'com.android.library'
apply plugin: 'groovyx.android'
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'org.codehaus.groovy:groovy-android-gradle-plugin:1.1.0'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') { …Run Code Online (Sandbox Code Playgroud)