修改Project模式下的/build.gradle 换源

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
//        google()
//        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
//        google()
//        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

关掉AS再打开,飞起!

报错

Module: 'simpleDemo' platform 'android-30' not found.

解决办法:

修改\simpleDemo\build.gradle,从

compileSdkVersion 30

compileSdkVersion 33

保存,重启即可.

没有android33? 点这看:

怎么下载更多的android版本? 。。。。 没有爬墙的梯子,就别想了。。。。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐