如何解决':app @ releaseUnitTest / compileClasspath'的依赖关系

时间:2019-11-18 07:29:39

标签: android android-studio android-support-library android-appcompat

无法解决':app @ releaseUnitTest / compileClasspath'的依赖关系:找不到与com.android.support:appcompat-v7:29.+匹配的任何版本。

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    defaultConfig {
        applicationId "com.example.usman.testing"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:29.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

1 个答案:

答案 0 :(得分:1)

  

您的应用程序包含库依赖项不包含的构建类型

android {
  buildTypes {
      release {
          ...
      }
      dexOptions {
          ...
        // release & debug is in project animators
        matchingFallbacks = ['release', 'debug']
      }
      debug {
          ...
      }
    }
}

设置匹配的配置后备显然是解决此问题的正确方法。