这是我的代码,我正在编写一个关于制作天气应用程序的教程,但我在与gradle同步时遇到错误

Here is my code, I am follwing a tutorial on making a weather app but I am getting errors while syncing with gradle

提问人:Ankit Debroy 提问时间:8/24/2023 最后编辑:fernandosprAnkit Debroy 更新时间:8/24/2023 访问量:36

问:

以下是我使用的依赖项:

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 错误处理 build.gradle retrofit2 依赖解析器

评论


答:

1赞 fernandospr 8/24/2023 #1

正确的依赖项是:

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

您可以在此处验证它们: