最終解決方案
參考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 '你當前依賴的版本號'
}
}
}
}