如何将okhttp库导入android studio?

时间:2014-12-12 00:36:07

标签: android android-studio okhttp

我想将okhttp源代码(不是jar)导入到android studio作为模块。有什么建议吗?谢谢 !

4 个答案:

答案 0 :(得分:10)

除非您在应用中出于某种原因需要源代码,否则可以通过添加

将其添加为库
implementation 'com.squareup.okhttp3:okhttp:3.10.0'

到您的Gradle构建脚本

答案 1 :(得分:2)

他们的来源可以在Github上找到:https://github.com/square/okhttp

将其克隆到您的计算机上,然后将其导入您的项目。

答案 2 :(得分:1)

将此行添加到模块级别build.gradle脚本(不是项目级别):

dependencies {
    // ...
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
}

然后单击右上角的构建图标(绿色斧头)。

答案 3 :(得分:0)

OkHttp是一个java项目,你可以使用idea而不是Android studio。

  1. 开放的想法
  2. 项目→打开→在项目根目录中选择pop.xml
  3. 等一会儿