解决android studio Gradle无法同步问题

打开根目录build.gradle

buildscript {
   
 
    repositories {
        // 添加阿里云 maven 地址
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
 
        google()
        jcenter()
     
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}
 
allprojects {
    repositories {
        // 添加阿里云 maven 地址
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
 
        google()
        jcenter()
    
        maven { url 'https://jitpack.io' }
    }
}
 
task clean(type: Delete) {
    delete rootProject.buildDir
}

 删除项目文件夹里的.gradle文件夹,重新打开android studio

posted @ 2020-04-12 18:23  IWing  阅读(1579)  评论(0编辑  收藏  举报