老师我是用 android studio 开发 的 ,gradle已经导入 retrofit, 但是不能 import
来源:4-5 案例:使用 Retrofit 发送网络请求

lovejavacoffee
2021-06-20
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1’
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.squareup.retrofit2:retrofit:2.6.2"
classpath "com.squareup.retrofit2:converter-gson:2.6.2"
classpath "com.google.code.gson:gson:2.8.1"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
写回答
1回答
-
可能是因为jcenter,改成mavenCentral试试。jcenter下线了,回头我把代码更新下
022023-01-18
相似问题