打开项目的 build.gradle ,在 buildscript 中的 repositories 和 allprojects 中的 repositories 加入 :
mavenCentral()
maven { url 'https://maven.google.com' }
如下图所示:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath "io.realm:realm-gradle-plugin:2.0.2"
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
jcenter()
}
}