Gradle Sync Failed:Setup Project Failed:Null

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle Sync Failed:Setup Project Failed:Null相关的知识,希望对你有一定的参考价值。

很长一段时间我没有那样的问题。可能与测试该项目的预览版有关。

[当前在稳定的android Studio版本3.2.1上,我总是会收到此奇怪的错误:enter image description here

我已经做了:

  • 使缓存无效并重新启动
  • 干净的版本
  • 测试终端版本(一切正常)
  • 从头开始导入项目(它很小,所以那里没有问题-相同的问题)
  • 完全删除了/Users/myUserName/.gradle/文件夹
  • 在以下位置删除了我的所有Android Studio首选项:/Users/myUserName/Library/Preferences/AndroidStudio3.2 /
  • 已删除“ .iml”文件和“ .idea”文件夹,并尝试再次导入项目
  • 将系统Gradle版本更新为最新的Gradle(4.10.2)
  • 将项目移动到其他目录(接近根级别)以仅测试所有可能的错误
  • 更新/更改的构建工具,targetSdkVersion和compileSdkVersion
  • 尝试禁用并重新启用AndroidStudio android支持插件

基本上所有的努力都没有任何改善。尽管如此,AS设置仍然存在一些问题,因为在Terminal构建中,一切工作都非常完美。其他项目仍然可以完美运行。

有人知道如何解决此问题吗?

null
java.lang.StackOverflowError
    at com.intellij.openapi.util.io.FileUtil.toCanonicalPath(FileUtil.java:703)
    at com.intellij.openapi.util.io.FileUtil.toCanonicalPath(FileUtil.java:668)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.normalizeRootUrl(PersistentFSImpl.java:1039)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.findRoot(PersistentFSImpl.java:970)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.findRoot(PersistentFSImpl.java:57)
    at com.intellij.openapi.vfs.newvfs.VfsImplUtil.prepare(VfsImplUtil.java:153)
    at com.intellij.openapi.vfs.newvfs.VfsImplUtil.findFileByPath(VfsImplUtil.java:52)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.findFileByPath(LocalFileSystemBase.java:45)
    at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.findFileByIoFile(LocalFileSystemBase.java:61)
    at com.intellij.openapi.vfs.VfsUtil.findFileByIoFile(VfsUtil.java:210)
    at com.android.tools.idea.gradle.util.GradleUtil.getGradleSettingsFile(GradleUtil.java:364)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateSettingsFile(GradleDslFileCache.java:72)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateSettingsFile(BuildModelContext.java:111)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:191)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.process(GroovyDslParser.java:170)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.visitMethodCallExpression(GroovyDslParser.java:146)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrMethodCallExpressionImpl.accept(GrMethodCallExpressionImpl.java:47)
    at org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor.visitElement(GroovyPsiElementVisitor.java:18)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:200)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:824)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:143)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFile.parse(GradleDslFile.java:103)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:184)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.moduleModel(GradleSettingsModelImpl.java:188)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.getParentModuleModel(GradleSettingsModelImpl.java:228)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:202)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.process(GroovyDslParser.java:170)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.visitMethodCallExpression(GroovyDslParser.java:146)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrMethodCallExpressionImpl.accept(GrMethodCallExpressionImpl.java:47)
    at org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor.visitElement(GroovyPsiElementVisitor.java:18)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:200)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:824)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:143)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFile.parse(GradleDslFile.java:103)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:184)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.moduleModel(GradleSettingsModelImpl.java:188)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.getParentModuleModel(GradleSettingsModelImpl.java:228)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:202)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.process(GroovyDslParser.java:170)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.visitMethodCallExpression(GroovyDslParser.java:146)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrMethodCallExpressionImpl.accept(GrMethodCallExpressionImpl.java:47)
    at org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor.visitElement(GroovyPsiElementVisitor.java:18)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:200)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:824)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:143)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFile.parse(GradleDslFile.java:103)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:184)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.moduleModel(GradleSettingsModelImpl.java:188)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.getParentModuleModel(GradleSettingsModelImpl.java:228)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:202)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.process(GroovyDslParser.java:170)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.visitMethodCallExpression(GroovyDslParser.java:146)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrMethodCallExpressionImpl.accept(GrMethodCallExpressionImpl.java:47)
    at org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor.visitElement(GroovyPsiElementVisitor.java:18)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:200)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:824)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:143)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFile.parse(GradleDslFile.java:103)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:184)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.moduleModel(GradleSettingsModelImpl.java:188)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.getParentModuleModel(GradleSettingsModelImpl.java:228)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:202)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.process(GroovyDslParser.java:170)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$1.visitMethodCallExpression(GroovyDslParser.java:146)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.path.GrMethodCallExpressionImpl.accept(GrMethodCallExpressionImpl.java:47)
    at org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementVisitor.visitElement(GroovyPsiElementVisitor.java:18)
    at com.intellij.psi.impl.PsiElementBase.accept(PsiElementBase.java:274)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.acceptChildren(SharedImplUtil.java:200)
    at com.intellij.psi.impl.source.PsiFileImpl.acceptChildren(PsiFileImpl.java:824)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:143)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFile.parse(GradleDslFile.java:103)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:184)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.moduleModel(GradleSettingsModelImpl.java:188)
    at com.android.tools.idea.gradle.dsl.model.GradleSettingsModelImpl.getParentModuleModel(GradleSettingsModelImpl.java:228)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.populateWithParentModuleSubProjectsProperties(GradleBuildModelImpl.java:202)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.lambda$parseBuildFile$1(GradleBuildModelImpl.java:182)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:897)
    at com.android.tools.idea.gradle.dsl.model.GradleBuildModelImpl.parseBuildFile(GradleBuildModelImpl.java:181)
    at com.android.tools.idea.gradle.dsl.parser.files.GradleDslFileCache.getOrCreateBuildFile(GradleDslFileCache.java:47)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:96)
    at com.android.tools.idea.gradle.dsl.parser.BuildModelContext.getOrCreateBuildFile(BuildModelContext.java:101)
    at com.android.tools.idea.gradle.dsl.parser.apply.ApplyDslElement.addParsedElement(ApplyDslElement.java:60)
    at com.android.tools.idea.gradle.dsl.parser.elements.GradleDslBlockElement.addParsedElement(GradleDslBlockElement.java:44)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:488)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$300(GroovyDslParser.java:130)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser$2.visitApplicationStatement(GroovyDslParser.java:396)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.GrApplicationStatementImpl.accept(GrApplicationStatementImpl.java:37)
    at org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl.acceptGroovyChildren(GroovyPsiElementImpl.java:77)
    at org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl.acceptChildren(GrBlockImpl.java:71)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:388)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:382)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.parse(GroovyDslParser.java:286)
    at com.android.tools.idea.gradle.dsl.parser.groovy.GroovyDslParser.access$100(GroovyDslParser.java:130)
    at…

谢谢!

答案

正如Google Bug跟踪问题https://issuetracker.google.com/issues/118342198中所提及和分析的>

该问题是通过在库子项目中配置和添加gradle常量文件]而产生的。这意味着:

此gradle依赖文件已集成在顶级gradle文件中

appProject / someLibrary / some_constants.gradle

at

appProject / build.gradle

作者

apply from: "someLibrary/some_constants.gradle"

删除此行解决了同步问题。

[整体解决方案是将some_constants.gradle

文件移至顶层文件夹,然后直接将其导入。
apply from: "some_constants.gradle"

[有趣的部分:如果项目中只有一个库模块,则只会发生此同步问题。一旦还存在一个应用程序模块,便不再出现此问题。

[尝试以下步骤,让Android Studio重新生成.iml文件。

另一答案

[尝试以下步骤,让Android Studio重新生成.iml文件。

另一答案

升级到Android Studio 3.3

另一答案

对于我来说,将build.gradle上的Gradle升级到较新版本可以解决此问题。

在依赖项下的Gradle类路径的构建脚本中。

以上是关于Gradle Sync Failed:Setup Project Failed:Null的主要内容,如果未能解决你的问题,请参考以下文章

Gradle project sync failed

Gradle sync failed: Gradle sync failed: Timeout waiting to lock cp_init remapped class cache for a2h

android studio 更新 Gradle错误解决方法(Gradle sync failed)

Gradle工程错误:Gradle sync failed: Java home is different

Gradle sync failed: Connection timed out: connect

Gradle sync failed: Gradle version 2.2 is required. Current version is 2.10.