这是我的代码,我正在遵循制作天气应用程序的教程,但在与 gradle 同步时遇到错误

问题描述 投票:0回答:1

这是我使用的依赖项:

dependencies {
    implementation ("androidx.core:core-ktx:1.10.1")
    implementation ("androidx.appcompat:appcompat:1.6.1")
    implementation ("com.google.android.material:material:1.9.0")
    implementation ("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation ("androidx.gridlayout:gridlayout:1.0.0")
    testImplementation ("junit:junit:4.13.2")
    androidTestImplementation ("androidx.test.ext:junit:1.1.5")
    androidTestImplementation ("androidx.test.espresso:espresso-core:3.5.1")
    implementation ("com.airbnb.android:lottie:6.1.0")
    implementation ("com.square.retrofit2:converter-gson:2.9.0")
    implementation ("com.square.retrofit2: retrofit:2.9.0")
    implementation ("com.google.code.gson:gson:2.10.1")`
}

显示以下错误:

Failed to resolve: com.square.retrofit2:converter-gson:2.9.0
Failed to resolve: com.square.retrofit2: retrofit:2.9.0

使用不同版本(而不是2.9.0)也显示相同的错误。谁能帮我解决这个问题吗?

android error-handling build.gradle retrofit2 dependency-resolver
1个回答
0
投票

正确的依赖项是:

implementation ("com.squareup.retrofit2:converter-gson:2.9.0")
implementation ("com.squareup.retrofit2:retrofit:2.9.0")

您可以在这里验证它们:

© www.soinside.com 2019 - 2024. All rights reserved.