最终解决方案
参考stackoverflow第三个回答
compile 'com.android.support:appcompat-v7:你当前依赖的版本号'
compile 'com.android.support:design:你当前依赖的版本号'
compile 'com.android.support:cardview-v7:你当前依赖的版本号'
以下是参考文章support中v4 v7库版本错误详解,被 pass 掉的解决方案如下:
- 排除依赖中的指定包
compile ('com.mcxiaoke.viewpagerindicator:library:x.x.x') {
exclude group: 'com.android.support'
}
- force强制设置某个模块的版本
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:xx.x.x'
}
}
- com.android.support包名的库版本都是用你当前依赖的版本号
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '你当前依赖的版本号'
}
}
}
}