Android Studio版本:android-studio-2021.3.1.16-windows.exe
报错:Plugin [id: 'com.android.application', version: '7.3.0', apply: false] was not found in any of the following sources:
修改settings.gradle配置为:
报错:Plugin [id: 'com.android.application', version: '7.3.0', apply: false] was not found in any of the following sources:
修改settings.gradle配置为:
pluginManagement { 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' } gradlePluginPortal() google() mavenCentral() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 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() } } rootProject.name = "My Application" include ':app'
File>settings>Appearance&Behavior>System Settings>HTTP Proxy
选择:Auto-detect proxy settings
Automatic proxy configuration URL:http://mirrors.neusoft.edu.cn
File>Project Structure>Project>
Android Gradle Plugin Version:7.3.0
Gradle Version:7.4
这里不能随便改,因为Gradle Plugin的版本和Gradle的版本需要匹配的。可以去下载7.4的Gradle的binary-only包,解压。
然后在File>settings>Build,Execution,Deployment>Build Tools>Gradle中的Use Gradle from:Specified location>选择本地7.4版本的目录。
乱改后果是项目Build不成功。
先执行:File>Sync Project with Gradle Files,再执行Build>Rebuild Project。如果修改了settings.gradle配置,要重新执行一遍。