项目中不同Module的support包版本冲突怎么办?
只需要将以下代码复制到每个模块的build.gradle(Module:xxx)文件的根目录即可:
1
2
3
4
5
6
7
8
9
10
11
|
// 统一当前Module的所有support包版本 configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '28.0.0' } } } } |
模板代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { ... } buildTypes { ... } lintOptions { ... } } dependencies { ... } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '28.0.0' } } } } |
以上就是相关全部知识点内容,感谢大家的学习和对服务器之家的支持。
原文链接:https://www.cnblogs.com/tc310/p/11511024.html