运行项目时出现此错误:



有人知道如何解决吗?提前致谢!

buildscript {
  repositories {
      google()
      jcenter()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:3.4.1'
      classpath 'com.google.gms:google-services:4.2.0'
  }
}

allprojects {
  repositories {
      google()
      jcenter()
  }

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')
}

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

最佳答案

使用gradlew运行--stacktrace命令以获取错误的详细信息。

还要检查build.gradle文件。
在答案报告的区块中,{ }的位置错误。

allprojects {
  repositories {
      google()
      jcenter()
  }
}   //it is missing in your code

和:
   task clean(type: Delete) {
      delete rootProject.buildDir
   }
}// You have to remove this.

08-05 13:55