【问题标题】:Implementation OKHTTP doesn't work on Android project实现 OKHTTP 不适用于 Android 项目
【发布时间】:2022-01-20 15:07:47
【问题描述】:

我遵循了这个教程:https://www.journaldev.com/13629/okhttp-android-example-tutorial 但是当我尝试启动项目时给我这个错误:

Execution failed for task ':app:checkDebugAarMetadata'.
 Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
    Could not find com.squareup.okhttp3:okhttps:3.4.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
       - https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
       - https://jcenter.bintray.com/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
     Required by:
         project :app

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

而正是当我尝试写 implementation 'com.squareup.okhttp3:okhttps:3.4.1'

【问题讨论】:

  • 我在查看 square 文档,并没有出现 okhttps,只有 okhttp -> implementation("com.squareup.okhttp3:okhttp:4.9.3") 可以不带 s 试试吗?

标签: android maven dependencies okhttp


【解决方案1】:

在你的 build.gredle 文件中使用它

 dependencies {    //Retrofit
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
        implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
        implementation 'com.squareup.okhttp3:okhttp:4.9.0'
        implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.4.1'
    }

这可能对某人有帮助

【讨论】:

    猜你喜欢
    • 2014-11-10
    • 2011-05-12
    • 2016-01-24
    • 1970-01-01
    • 2015-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多