gradle添加 implementation 'com.squareup.okhttp3:okhttp:3.8.1' 是报错:
Unable to resolve dependency for ':app@ReleasesDebug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.8.1) Open File Show Details
原因是无法下载okhttp,
方法:
在项目的gradle里面添加如下:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// classpath 'com.android.tools.build:gradle:2.2.0-alpha1'
// classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
maven { url 'https://maven.google' }
maven {
url 'https://oss.sonatype/content/repositories/snapshots'
}
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
更多推荐
Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.8.1)
发布评论