【发布时间】:2021-03-02 21:49:59
【问题描述】:
我尝试为 com.squareup.retrofit2 模块构建.gradle 失败
implementation "com.squareup.retrofit2:convertor-gson:${retrofitVersion}"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
带有错误信息:
Failed to resolve: com.squareup.retrofit2:convertor-gson:2.7.1
我的项目级 build.gradle 文件是:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级 build.gradle 文件为:
compileSdkVersion 29
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.hedylamarr"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Android Studio 4.1.2
Build #AI-201.8743.12.41.7042882, built on December 20, 2020
Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 12
Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true
【问题讨论】:
-
试试 2.9.0
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' -
我试过了,还有几个..同样的错误..
标签: android android-studio build.gradle retrofit2