android studio提示 Add Google Maven repository and sync project Open File解决安案

时间:2024-04-03 13:26:19

android studio提示 Add Google Maven repository and sync project Open File解决安案

1、androidstudio support包报错 add google maven respository and sync project

2、Add Google Maven repository and sync project Open File

在项目下的build.gradle文件下两个地方都加上google()

android studio提示 Add Google Maven repository and sync project Open File解决安案
1、androidstudio support包报错 add google maven respository and sync project

2、Add Google Maven repository and sync project Open File

在项目下的build.gradle文件下两个地方都加上google()

android studio提示 Add Google Maven repository and sync project Open File解决安案

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()//加上这行
//用这个替换jcenter(),避免长时间下载不成功jcenter()(可以不注释就center())
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
// jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
}
}

allprojects {
repositories {
google()//加上这行
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
//jcenter()
}
}