首页 > 解决方案 > 错误:无法解析“:app@releaseUnitTest/compileClasspath”的依赖关系:无法解析com.squareup.retrofit2:retrofit:2.3.0

问题描述

此代码显示改造依赖错误,我目前使用的是Android Studio 3.5.2。请帮我解决这个依赖

错误:无法解析“:app@releaseUnitTest/compileClasspath”的依赖关系:无法解析com.squareup.retrofit2:retrofit:2.3.0

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.blog"
        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'
        }
    }
}

implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:convertor-gson:2.3.0'

标签: androiddependency-management

解决方案


尝试使用最新版本的改造,如下所示。

implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'

推荐阅读