修改根目录的build.gradle 增加 repositories 配置,然后再File>Sync Project with Gradle Files,再执行Build>Rebuild Project
buildscript { ext { agp_version = '7.3.0' } repositories { maven { url "https://jitpack.io" } maven { url 'https://maven.aliyun.com/repository/releases' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } maven { url 'https://maven.aliyun.com/repository/public' } google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.3.0' } }// Top-level build file where you can add configuration options common to all sub-projects/modules. task clean(type: Delete) { delete rootProject.buildDir }