情境
将Android Studio从较低版本升级到3.0.1(或者更高),报出Could not resolve com.android.support:multidex:1.0.2错误。
解决方式
在project的build.gradle的buildscript和allprojects的repositories中里添加阿里云的maven镜像
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
复制代码
添加完之后大概是如下样子
buildscript {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}
复制代码
添加好之后编译运行即可。
转载自:https://juejin.cn/post/6844903653564760071 作者:云深