新装的Android Studio,新建工程就遇到以下问题
Gradle sync failed: Plugin [id: 'com.android.application', version: '7.1.1', apply: false] was not found in any of the following sources:
今天解决了,但是参考了好几个博客:
1. 问题原因是配置了proxy
把File->settings和gradle.properties里面的proxy配置都检查一下,都关闭掉就OK了
参考以下博客
新建项目下Gradle sync报错Plugin was not found in any of the following sources_Aerith1013的博客-CSDN博客
2.
在src里面的build.gradle中
plugins {
id ‘com.android.application’
}
的上面加上
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
}
}
————————————————
版权声明:本文为CSDN博主「胡家骏」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44319203/article/details/124517733
事实上,我在src里面的build.gradle中和工程的build.gradle中都添加了上述代码(注意版本号要按实际情况修改)
改了上述两个地方后,有时候还不行,此时重启Android Studio,就OK了