我正在尝试添加OkHttp
到我的项目中,我同时下载OkHttp
和Okio
库,并将其添加到libs
目录中。
比我添加编译方法:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我尝试构建应用程序,但出现此错误:
Error:(27, 1) A problem occurred evaluating root project 'APP'.
> Could not find method compile() for arguments [com.squareup.okhttp3:okhttp:3.4.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
知道可能是什么问题吗?我正在使用Mac OS上的Android Studio
删除根gradle的这一行:
compile 'com.squareup.okhttp3:okhttp:3.4.1'
并将其添加到依赖项的应用程序的模块build.gradle中
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句