找不到满足版本限制的'com.google.code.findbugs:jsr305'版本

问题描述 投票:0回答:1

生成签名APK发布时,我收到此错误消息:

Cannot find a version of 'com.google.code.findbugs:jsr305' that satisfies the version constraints: 
   Dependency path 'XX:app:unspecified' --> 'androidx.test.espresso:espresso-core:3.1.2-alpha01' --> 'com.google.code.findbugs:jsr305:2.0.1'
   Constraint path 'XX:app:unspecified' --> 'com.google.code.findbugs:jsr305' strictly '1.3.9' because of the following reason: debugRuntimeClasspath uses version 1.3.9

这是我的应用程序:gradle

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.XX.XX"
    minSdkVersion 25
    targetSdkVersion 28
    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(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.guava:guava:22.0-android'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
}

但是,如果我为调试构建它工作正常,但当我生成签名版本时我收到此消息,香港专业教育学院尝试谷歌,但似乎没有找到正确的答案。

java android gradle build apk
1个回答
2
投票

我今天遇到了类似的问题并发现了这个问题:https://github.com/trello/RxLifecycle/issues/154

通过在依赖项下的(module:app)中编辑Gradle Scripts build.gradle来管理以修复我的问题:

androidTestImplementation 'com.google.code.findbugs:jsr305:1.3.9'

我最初尝试了不同的版本号,但得到了一个错误,告诉我使用什么版本,所以你可能需要尝试几次。


0
投票

我不确定这个问题的确切原因。但是,在尝试了几个选项后,它会自动开始工作

如果您正在使用Room组件,并为其编写测试。您需要添加以下依赖项。

// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:2.1.0"

// Test helpers
testImplementation "androidx.room:room-testing:2.1.0"
© www.soinside.com 2019 - 2024. All rights reserved.