带有Gradle 4.1问题的房间持久性库

时间:2017-12-03 09:54:27

标签: java android gradle build.gradle

我尝试在我的项目中使用Room persistence library,所以我添加了这个 to build.gradle(project):

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

和build.gradle(模块)的代码:

implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
testImplementation "android.arch.persistence.room:testing:1.0.0"

这是整个依赖项模块:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
testImplementation "android.arch.persistence.room:testing:1.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'

}

但每次我尝试同步Gradle时都会加载很长时间,最后我遇到了类似的问题:

Gradle同步失败:无法使用Gradle分发“https://services.gradle.org/distributions/gradle-4.1-all.zip”运行构建操作。

0 个答案:

没有答案