刚刚安装好Android studio后,可能会出现gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly,本人也是弄了一天才弄明白,一把辛酸一把泪,下面这些是我整理好的一些大佬的解决方案,这几个方法都可以试试,最中要的就是在gradle系列文件夹下面要拥有gradle-7.0.2-all.zip这个包,如图
然后就是要在wrapper.properties?文件下添加路径,如图(第二行那个)注意一定是-all,有些可能是-bin,我就是将-bin改成-all就行了
?最后就是需要在build.gradle配置代码,这是我整个的代码,你们对比着添加
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
最后就可以解决了,希望以上教程能帮助大家
大佬参考
gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly_Angela_journey-CSDN博客
AndroidStudio 安装Gradle问题gradle project sync failed.Basic functionality(e.g.editing,debugging) will n_runrun117的博客-CSDN博客
?【已解决】Android Studio下,gradle project sync failed 错误_一杯刘-CSDN博客
解决Android Studio提示gradle project sync failed报错的解决方法-百度网盘下载-Java自学者论坛 - Powered by Discuz! ?
|