将Room Persistence添加到模块时出错

时间:2017-10-02 04:53:24

标签: android android-gradle android-room android-mvp

这就是我的gradle看起来的样子,我已经注释了问题行(使用完整的gradle代码更新)

  

数据层

apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':models')
    testCompile 'junit:junit:4.12'
    compile "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    compile "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    compile "io.reactivex.rxjava2:rxjava:$rootProject.rxjavaVersion"
    compile "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitRxjava2Version"
    compile "com.google.dagger:dagger:$rootProject.daggerVersion"
    //compile "android.arch.persistence.room:runtime:$rootProject.roomVersion"
}
  

域的层

apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':data-layer')
    testCompile 'junit:junit:4.12'
}
  

表示层

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.admin.umbrella"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile project(':domain-layer')
    compile 'com.android.support:appcompat-v7:26.+'
    compile "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"
    compile "com.android.support:cardview-v7:$rootProject.cardViewVersion"
    compile "com.android.support:recyclerview-v7:$rootProject.recyclerviewVersion"
    compile "com.jakewharton:butterknife:$rootProject.butterknifeVersion"
    compile "com.android.support:design:$rootProject.designVersion"
    compile "com.google.dagger:dagger:$rootProject.daggerVersion"
    annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
    testCompile 'junit:junit:4.12'
}
  

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    constraintLayoutVersion = '1.0.2'
    cardViewVersion = '26.1.0'
    recyclerviewVersion = '26.1.0'
    butterknifeVersion = '8.8.1'
    designVersion = '26.1.0'
    daggerVersion = '2.11'
    roomVersion = '1.0.0-beta1'
    retrofitRxjava2Version = '2.3.0'
    retrofitVersion = '2.3.0'
    rxjavaVersion = '2.0.1'
}

我正在使用MVP并将每个图层拆分为不同的模块。在我的数据层中,当我尝试导入房间库时,我收到了错误

  

“错误:模块'伞:数据层:未指定'取决于一个或多个Android库但是是一个罐子”

我不完全明白这意味着什么,我可以采取哪些步骤来调查和解决这个问题?

0 个答案:

没有答案