应用程序(25.4.0)的已解决版本来自哪里? [复制]
Posted
技术标签:
【中文标题】应用程序(25.4.0)的已解决版本来自哪里? [复制]【英文标题】:where is this Resolved versions for app (25.4.0) from? [duplicate] 【发布时间】:2018-02-10 00:56:04 【问题描述】:更新:查看了“潜在的重复链接”,但没有从那里得到完整的答案。
感谢您指向Using gradle to find dependency tree。但无法从那里得到答案,
应用程序 (25.4.0) 的已解决版本从哪里来(为什么不说已解决 (25.0.1),是否有地方可以将版本指定为“已解决”)?
这是检查依赖关系图以了解 lib/sdk 正在使用什么的唯一方法吗?问题是即使你发现了,但如果你必须使用你选择的版本,你会怎么做?
正如您所提到的,如果您强制使用较新的版本,可能会导致 lib/sdk 无法正常运行。
最佳/推荐的方法是什么?
更新二:
尝试了链接中建议的解决方案:,它仍然不起作用。
但是使用
configurations.all
exclude group:"com.android.support", module: "support-v4"
exclude group:"com.android.support", module: "support-annotations"
exclude group:"com.android.support", module: "support-compat"
exclude group:"com.android.support", module: "support-core-utils"
exclude group:"com.android.support", module: "support-core-utils"
将编译没有错误,但应用程序无法启动(在 lib 内崩溃)。
图表显示:
Information:Gradle tasks [androidDependencies]
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.android.support:support-annotations:25.4.0@jar
Error:\--- com.android.support:support-compat:25.4.0@aar
Error:\--- com.android.support:support-annotations:25.4.0@jar
Error:+--- com.google.android.gms:play-services-identity:9.2.1@aar
Error:| +--- com.google.android.gms:play-services-base:9.2.1@aar
Error:| | +--- com.google.android.gms:play-services-basement:9.2.1@aar
Error:| | | \--- com.android.support:support-v4:25.4.0@aar
Error:| | | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-fragment:25.4.0@aar
Error:| | | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.google.android.gms:play-services-tasks:9.2.1@aar
Error:| | \--- com.google.android.gms:play-services-basement:9.2.1@aar
Error:| | \--- com.android.support:support-v4:25.4.0@aar
Error:| | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-utils:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-fragment:25.4.0@aar
Error:| | +--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-media-compat:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | +--- com.android.support:support-core-ui:25.4.0@aar
Error:| | | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | | \--- com.android.support:support-compat:25.4.0@aar
Error:| | | \--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-core-utils:25.4.0@aar
Error:| | +--- com.android.support:support-annotations:25.4.0@jar
Error:| | \--- com.android.support:support-compat:25.4.0@aar
Error:| | \--- com.android.support:support-annotations:25.4.0@jar
尝试了建议的解决方案(没有配置。所有 ...)它仍然得到错误:
Warning:Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-ui' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-utils' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-v4' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-fragment' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-annotations' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-compat' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-ui' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-core-utils' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-v4' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-fragment' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
Warning:Conflict with dependency 'com.android.support:support-annotations' in project 'helloworldtest'. Resolved versions for app (25.4.0) and test app (25.0.1) differ.
摇篮:
configurations.all
exclude group:"com.android.support", module: "support-v4"
exclude group:"com.android.support", module: "support-annotations"
exclude group:"com.android.support", module: "support-compat"
exclude group:"com.android.support", module: "support-core-utils"
exclude group:"com.android.support", module: "support-core-utils"
List ExGroups = [ 'com.android.support' ]
List ExModules = [ 'support-annotations', 'support-compat', 'support-core-utils', 'support-media-compat' ]
dependencies
testCompile 'junit:junit:4.11'
compile 'com.android.support:support-v4:25.0.1'
// androidTestCompile 'com.android.support:support-v4:25.0.1'
androidTestCompile ('com.android.support:support-v4:25.0.1')
ExGroups.each exclude group: '$it'
ExModules.each exclude module: '$it'
// androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
// androidTestCompile files('libs/android-junit-report-1.5.8.jar')
// // dependencies for uiautomator
// androidTestCompile 'com.android.support.test:runner:0.2'
// androidTestCompile 'com.android.support.test:rules:0.2'
// androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
// after adding this line it got error
//compile 'com.zone.android.identity:account:1.0.0’
compile ('com.zone.android.identity:account:1.0.0)
ExGroups.each exclude group: '$it'
ExModules.each exclude module: '$it'
=== 初始帖子:
正在测试一个库,在拉入它之前,该应用程序只是一个简单的“hello world”测试应用程序。它适用于 gradle 的依赖项。然后在 gradle 的依赖项中为 lib 添加了这一行:
compile 'com.zone.android.data:account:1.0.0’
然后出现错误:
Conflict with dependency 'com.android.support:support-media-compat' in project 'helloworld'.
Resolved versions for app (25.4.0) and test app (25.0.1) differ.
在gradle的依赖中,把这两行改成25.4.0就可以了。
compile 'com.android.support:support-v4:25.0.1' //<== change to 25.4.0
androidTestCompile 'com.android.support:support-v4:25.0.1' //<== change to 25.4.0
问题是应用程序 (25.4.0) 的已解决版本来自哪里?在 gradle 中看不到有 25.4.0 指定。
为什么添加这行后:compile 'com.zone.android.data:account:1.0.0' 然后开始显示错误?
如果它是由这个 lib com.zone.android.data 引起的,我们是否可以假设它指定了一些与我们项目使用的版本不同的版本,这是否意味着我们必须使用与 lib/sdk 版本相同的版本已使用(我们如何知道它使用的是什么版本?如果 lib 使用了一些旧版本而我的应用想要使用新版本怎么办)?
那么,如果它们使用不同版本(或未知),那么在 lib/sdk 中包含/提取的最佳做法是什么?
dependencies
testCompile 'junit:junit:4.11'
compile 'com.android.support:support-v4:25.0.1'
androidTestCompile 'com.android.support:support-v4:25.0.1'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1'
androidTestCompile files('libs/android-junit-report-1.5.8.jar')
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
// after adding this line it started to get error
compile 'com.zone.android.data:account:1.0.0’
【问题讨论】:
使用gradle app:dependencies
查看依赖关系树并确定谁需要哪个版本的内容
感谢您指向***.com/questions/21645071/…。但无法从那里得到答案,1.这个应用程序(25.4.0)的已解决版本来自哪里? 2.这是检查依赖图以了解 lib/sdk 正在使用什么的唯一方法吗?问题是即使你发现了,但如果你必须使用你选择的版本,你会怎么做?正如您所提到的,如果您强制使用较新的版本,可能会导致 lib/sdk 无法正常运行。最好/推荐的方法是什么?
1.查看依赖项调用的输出,您将看到每个库正在请求什么,以及用于解决它的内容。 2. 这是最好的方法,因为 gradle 是在构建期间实际解析依赖关系图的工具。
这是依赖关系的永恒问题。您的依赖项必须具有兼容的依赖项。您使用的每个包都应明确记录每个内容。
【参考方案1】:
这是因为库有:
compile 'com.zone.android.data:account:1.0.0'
其中已经包含一个支持媒体兼容。因此,您需要从中排除支持库并使用您的项目支持库。您可以通过以下方式实现它:
compile ('com.zone.android.data:account:1.0.0')
exclude group: 'com.android.support', module: 'support-media-compat' // or support-v4
请注意,该库可能需要 25.4.0 支持库,因为以前支持的特定 API 方法不支持图书馆。因此,您需要对其进行彻底的测试。
【讨论】:
危险,但有效。不过使用时要小心。以上是关于应用程序(25.4.0)的已解决版本来自哪里? [复制]的主要内容,如果未能解决你的问题,请参考以下文章
使用 NSDictionary 填充 UITableView,其中包含来自 mysql db 的已解析 JSON 数据
Xcode 5 应用程序在 IOS 8 的已发布版本下无法运行