Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.8.1)

编程入门 行业动态 更新时间:2024-10-18 19:24:13

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)

本文发布于:2023-06-14 07:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1450322.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:jar   okhttp   download   squareup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!