You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio生成签名APK时出现:app:lintVitalRelease依赖冲突错误

Android Studio生成签名APK时的依赖冲突问题

错误现象

生成签名APK时触发构建失败,核心错误为无法确定任务:app:lintVitalRelease的依赖项,具体依赖解析失败信息如下:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve androidx.concurrent:concurrent-futures:{strictly 1.0.0}.
     Required by:
         project :app
      > Cannot find a version of 'androidx.concurrent:concurrent-futures' that satisfies the version constraints: 
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.test.ext:junit:1.1.5' --> 'androidx.test:core:1.5.0' --> 'androidx.concurrent:concurrent-futures:1.1.0'
           Constraint path 'DBRL ORDERS:app:unspecified' --> 'androidx.concurrent:concurrent-futures:{strictly 1.0.0}' because of the following reason: debugRuntimeClasspath uses version 1.0.0
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.appcompat:appcompat:1.6.1' --> 'androidx.core:core:1.9.0' --> 'androidx.concurrent:concurrent-futures:1.0.0'

   > Could not resolve androidx.concurrent:concurrent-futures:1.1.0.
     Required by:
         project :app > androidx.test.ext:junit:1.1.5 > androidx.test:core:1.5.0
      > Cannot find a version of 'androidx.concurrent:concurrent-futures' that satisfies the version constraints: 
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.test.ext:junit:1.1.5' --> 'androidx.test:core:1.5.0' --> 'androidx.concurrent:concurrent-futures:1.1.0'
           Constraint path 'DBRL ORDERS:app:unspecified' --> 'androidx.concurrent:concurrent-futures:{strictly 1.0.0}' because of the following reason: debugRuntimeClasspath uses version 1.0.0
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.appcompat:appcompat:1.6.1' --> 'androidx.core:core:1.9.0' --> 'androidx.concurrent:concurrent-futures:1.0.0'

   > Could not resolve androidx.concurrent:concurrent-futures:1.0.0.
     Required by:
         project :app > androidx.core:core:1.9.0
      > Cannot find a version of 'androidx.concurrent:concurrent-futures' that satisfies the version constraints: 
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.test.ext:junit:1.1.5' --> 'androidx.test:core:1.5.0' --> 'androidx.concurrent:concurrent-futures:1.1.0'
           Constraint path 'DBRL ORDERS:app:unspecified' --> 'androidx.concurrent:concurrent-futures:{strictly 1.0.0}' because of the following reason: debugRuntimeClasspath uses version 1.0.0
           Dependency path 'DBRL ORDERS:app:unspecified' --> 'androidx.appcompat:appcompat:1.6.1' --> 'androidx.core:core:1.9.0' --> 'androidx.concurrent:concurrent-futures:1.0.0'


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

项目Gradle配置

apply plugin: 'com.android.application'

android {
    compileSdkVersion 31
    buildToolsVersion "29.0.2"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.example.dbrlorders"
        minSdkVersion 14
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.volley:volley:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

问题原因

项目存在依赖版本冲突:

  • 主依赖链:androidx.appcompat:1.6.1 → androidx.core:1.9.0 → androidx.concurrent:concurrent-futures:1.0.0
  • 测试依赖链:androidx.test.ext:junit:1.1.5 → androidx.test:core:1.5.0 → androidx.concurrent:concurrent-futures:1.1.0
  • 构建系统的严格版本约束锁定了1.0.0,但测试依赖需要1.1.0,导致解析失败。

解决方案

方案1:强制统一依赖版本(推荐)

在android代码块中添加版本强制策略,锁定concurrent-futures为兼容版本:

android {
    // ... 原有配置
    configurations.all {
        resolutionStrategy.force 'androidx.concurrent:concurrent-futures:1.1.0'
    }
}

方案2:直接声明依赖版本

在dependencies块中显式添加concurrent-futures的指定版本,覆盖依赖传递:

dependencies {
    // ... 原有依赖
    implementation 'androidx.concurrent:concurrent-futures:1.1.0'
}

方案3:降低测试依赖版本

调整测试依赖版本,使其依赖的concurrent-futures与主依赖一致:

dependencies {
    // ... 原有依赖
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

额外优化

将buildToolsVersion升级到与compileSdkVersion 31匹配的版本(如31.0.0),避免工具链版本不匹配引发的潜在问题:

android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"
    // ... 其他配置
}

内容的提问来源于stack exchange,提问作者Sualak Sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 21:55:04