android - 如何解决“:app@releaseUnitTest/compileClasspath”的依赖关系
问题描述
无法解析 ':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'
}
解决方案
您的应用包含库依赖项不包含的构建类型
android {
buildTypes {
release {
...
}
dexOptions {
...
// release & debug is in project animators
matchingFallbacks = ['release', 'debug']
}
debug {
...
}
}
}
设置匹配的配置回退显然是解决这个问题的正确方法。
推荐阅读
- android - 与 Android Studio 集成的增强现实 - 将 Vuforia SDK 集成到现有的 android studio 项目中
- azure-blob-storage - 添加或修改 blob 时的逻辑应用向我发送垃圾邮件
- javascript - 如何使用 amCharts 对用作项目符号的图像进行舍入?
- c# - 泛型参数是否有等效的“this”
- python - Python - 回复电子邮件
- c# - 在 C# 中使用 RSA/ECB/OAEPWithSHA-1AndMGF1Padding 加密
- mysql - 如何在 nifi 中插入批量记录
- google-compute-engine - 来自其他地区 GCP 的静态 IP
- html - 如何在html中使用从bash脚本传递的参数
- javascript - 当 OPTIONS 请求的 statusCode 为 200 时,为什么我会在 API Gateway GET 请求上收到 CORS 错误?