android报错(org.gradle.internal.exceptions.LocationAwareException: New Gradle Sync is not supported due to containing Kotlin modules)

报错内容

org.gradle.internal.exceptions.LocationAwareException: New Gradle Sync is not supported due to containing Kotlin modules
    ...
Caused by: com.android.tools.idea.gradle.project.sync.ng.NewGradleSyncNotSupportedException: New Gradle Sync is not supported due to containing Kotlin modules
    ... 75 more

原因:

国内访问不到google的jcenter(),需要使用代理

buildscript {
    repositories {
        // 阿里云 maven 地址
        // maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        // maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        // maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        // google()
        // jcenter()
    }
}

allprojects {
    repositories {
        // 阿里云 maven 地址
        // maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        // maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        // maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        // google()
        // jcenter()
    }
}

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wind.kaisa@gmail.com

💰

×

Help us with donation