gpt4 book ai didi

android - Gradle 同步失败 : Setup Project Failed: Null

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:04:02 25 4
gpt4 key购买 nike

很长一段时间我都没有遇到过这样的问题。可能与在该项目上测试预览版本有关。

目前在稳定的 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 设置一定有问题,因为在终端构建中一切都完美无缺。其他项目仍然完美运行。

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

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 错误跟踪问题 https://issuetracker.google.com/issues/118342198 中提到和分析的那样

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

这个gradle依赖文件被集成到顶层gradle文件中

appProject/someLibrary/some_constants.gradle

appProject/build.gradle

通过

apply from: "someLibrary/some_constants.gradle"

删除此行修复了同步问题。

整体解决方案是将 some_constants.gradle 文件移至顶级文件夹,然后直接将其导入那里。

apply from: "some_constants.gradle"

有趣的部分:如果项目中只有一个库模块,就会发生这个同步问题。一旦应用程序模块也存在,这个问题就不会再发生。

关于android - Gradle 同步失败 : Setup Project Failed: Null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52930843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com