[英]Android Gradle ResolutionStrategy force stil downloads previous version of lib
I have forced in my gradle to download this version of jsr305 as follows : 我已强迫我下载以下版本的jsr305:
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
I see that when I try to compile the gradle is resolving the version : 我看到当我尝试编译gradle时正在解析版本:
Inspite of that I see that during gradle sync the older versions (2.0.1 & 1.3.9) are still getting downloaded : 尽管如此,我发现在gradle同步期间,仍会下载旧版本(2.0.1和1.3.9):
I am getting compile errors as follows : com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.tools.r8.errors.CompilationError: Program type already present: javax.annotation.CheckForNull
我收到如下编译错误: com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.tools.r8.errors.CompilationError: Program type already present: javax.annotation.CheckForNull
com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.tools.r8.errors.CompilationError: Program type already present: javax.annotation.CheckForNull
Program type already present: javax.annotation.CheckForNull
com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.tools.r8.errors.CompilationError: Program type already present: javax.annotation.CheckForNull
Program type already present: javax.annotation.CheckForNull
I did a module level search and found that the CheckForNull.java
is present at multiple places in jsr305/2.0.1 jsr305/3.0.1 jsr305/1.3.9
我进行了模块级搜索,发现CheckForNull.java
存在于jsr305/2.0.1 jsr305/3.0.1 jsr305/1.3.9
多个位置
I have tried deleting ./gradle
folder and resync the project. 我尝试删除./gradle
文件夹并重新同步项目。 I see that gradle still downloads the previous jsr305 version. 我看到gradle仍下载先前的jsr305版本。
These are my dependencies in gradle : 这些是我在gradle中的依赖项:
implementation "com.facebook.react:react-native:${versions.reactNative}" implementation ("com.google.code.findbugs:annotations:3.0.1") { exclude group: 'net.jcip', module: 'jcip-annotations' }
My questions : 我的问题:
Created a test project that shows the behavior where the old lib versions are downloaded even after the forced resolution: https://github.com/vineyugave/scratchpad 创建了一个测试项目,该项目显示了即使强制解决后仍下载旧lib版本的行为: https : //github.com/vineyugave/scratchpad
Also you can see the gradle scan here : https://scans.gradle.com/s/tzrobr2zuar3c/dependencies?dependencies=jsr&expandAll 您也可以在这里查看gradle扫描: https ://scans.gradle.com/s/tzrobr2zuar3c/dependencies?dependencies = jsr & expandAll
module :firstlib
references implementation "com.google.code.findbugs:jsr305:2.0.0"
, which should possibly be implementation "com.google.code.findbugs:jsr305:3.0.2"
...but the other one build.gradle
does not really match the question, because it lacks react-native
. 模块:firstlib
引用implementation "com.google.code.findbugs:jsr305:2.0.0"
,它可能应该是implementation "com.google.code.findbugs:jsr305:3.0.2"
...但另一个build.gradle
并没有真正匹配该问题,因为它缺少react-native
。
the dependencies
of module :app
should look alike (only the changes): 模块:app
的dependencies
项应该看起来相似(只有更改):
dependencies {
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:support-v4:28.0.0"
implementation ("com.facebook.react:react-native:0.20.1") {
exclude group: "com.android.support", module: "recyclerview-v7"
exclude group: "com.android.support", module: "support-v4"
}
//noinspection GradleDependency
implementation "com.google.guava:guava:24.1-android"
}
configurations.all {
resolutionStrategy.force "com.google.code.findbugs:jsr305:3.0.2"
resolutionStrategy.force "com.google.guava:guava:24.1-android"
}
it's downloading elder versions, because they would need to be explicitly excluded from the dependencies, which demand them (as demonstrated above). 它正在下载旧版本,因为需要将它们从需要它们的依赖项中明确排除(如上所示)。 one can list them all with ./gradlew app:dependencies
and then exclude
them accordingly. 可以使用./gradlew app:dependencies
列出所有内容,然后相应地exclude
它们。
task :app:transformClassesWithMultidexlistForDebug
failed, because of support-library version conflicts caused by react-native
(already fixed in the above example). 任务:app:transformClassesWithMultidexlistForDebug
失败,原因是由react-native
引起的支持库版本冲突(在上面的示例中已修复)。
when moving those jniLibs
from armeabi
into armeabi-v7a
, it wouldn't complain about a missing stripping tool anymore. 当将这些jniLibs
从armeabi
移到armeabi-v7a
,它不会再抱怨缺少一个剥离工具。 however, then they wouldn't be loaded on arm64-v8a
anymore. 但是,它们将不会再加载到arm64-v8a
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.