Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Sync Failed: Setup Project Failed: Null

long time I didn't have an issue like that. Possibly it's related to testing the Preview build on that project.

Currently on stable Android Studio Version 3.2.1 I always get this strange error: enter image description here

What I already did:

  • Invalidate Caches and Restart
  • Clean Build
  • Test Terminal Build (everything works)
  • Import the project from scratch (it's really small so no problems there - same issue)
  • Deleted the /Users/myUserName/.gradle/ folder - completely
  • Deleted all my Android Studio preferences under: /Users/myUserName/Library/Preferences/AndroidStudio3.2/
  • Deleted ".iml" files and ".idea" folder and tried to import the project again
  • Updated system Gradle version to latest Gradle (4.10.2)
  • Moved the project to some other directory (nearly root level) to just test all possible errors
  • Updated / Changed build tools, targetSdkVersion and compileSdkVersion
  • Tried disable and reenable AndroidStudio android support plugin

Basically all efforts were without any improvements. Still, something must be wrong with the AS setup, because in Terminal builds everything works out perfect. Other projects still work perfectly.

Does anyone have any idea how to fix this?

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…

Thanks!

like image 574
cV2 Avatar asked Oct 22 '18 13:10

cV2


People also ask

Why is my Gradle sync failing?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.


1 Answers

As mentioned and analyzed in the Google bug tracking issue https://issuetracker.google.com/issues/118342198

The issue was produced by configuring and adding a gradle constants file within a library sub project. That means:

This gradle dependency file was integrated in the top-level gradle file

appProject/someLibrary/some_constants.gradle

at

appProject/build.gradle

by

apply from: "someLibrary/some_constants.gradle"

Removing this line fixed the sync issue.

The overall solution was to move the some_constants.gradle file to the top level folder and just import it there directly.

apply from: "some_constants.gradle"

The interesting part: This sync issue just occurred if there was ONLY a library module within the project. As soon as an app module was also present this issue didn't occur anymore.

like image 100
cV2 Avatar answered Oct 26 '22 05:10

cV2