網上常見的方法我都試過,都沒能解決,偶然看到的一個方法解決了,在這了記錄一下。
在App目錄下的build.gradle的android{ ... ....}中添加如下代碼,即可解決。(xx.xx.xx是運行項目的版本號)
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion 'xx.xx.xx'
}
}
}
}
