刷新gradle项目时,IntellIj 2018.3 java.lang.AssertionError

时间:2018-11-23 07:49:00

标签: java gradle intellij-idea project

从intellij开始的2天以来,我遇到了问题。刷新gradle项目时,控制台出现错误,并且我使用了Java 11。

我到处搜索,但是很少有人遇到这个问题。

  使用外部系统期间的

异常:java.lang.AssertionError       在org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.populateModuleContentRoots(BaseGradleProjectResolverExtension.java:272)       在com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.populateModuleContentRoots(AndroidGradleProjectResolver.java:185)       在org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)       在org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)       在org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)       在org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)       在org.jetbrains.plugins.gradle.service.project.TracedProjectResolverExtension.populateModuleContentRoots(TracedProjectResolverExtension.java:62)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:382)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access $ 200(GradleProjectResolver.java:76)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver $ ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:879)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver $ ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:862)       在org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:217)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:141)       在org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:76)       在com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda $ resolveProjectInfo $ 0(RemoteExternalSystemProjectResolverImpl.java:37)       在com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:58)       在com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)       在com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:45)       在com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:100)       在com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:166)       在com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:152)       在com.intellij.openapi.externalSystem.util.ExternalSystemUtil $ 3.execute(ExternalSystemUtil.java:554)       在com.intellij.openapi.externalSystem.util.ExternalSystemUtil $ 5.run(ExternalSystemUtil.java:659)       在com.intellij.openapi.progress.impl.CoreProgressManager $ TaskRunnable.run(CoreProgressManager.java:727)       在com.intellij.openapi.progress.impl.CoreProgressManager.lambda $ runProcess $ 2(CoreProgressManager.java:164)       在com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)       在com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)       在com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)       在com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)       在com.intellij.openapi.progress.impl.CoreProgressManager $ 4.run(CoreProgressManager.java:403)       在com.intellij.openapi.application.impl.ApplicationImpl $ 1.run(ApplicationImpl.java:314)       在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)       在java.util.concurrent.FutureTask.run(FutureTask.java:266)       在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)       在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)       在java.lang.Thread.run(Thread.java:745)

有人可以帮助我吗?

约安

11 个答案:

答案 0 :(得分:15)

这是错误的原因(在问题的注释中由Petr Rastegaev发现)

在该线程中,我找到了适合我的解决方法:

  

设置->构建-> Gradle->“为每个源集创建单独的模块”

     

检查失败,未检查是可以的。

答案 1 :(得分:3)

我遇到了完全相同的问题,不得不将IntelliJ降级到2018.2进行修复。

答案 2 :(得分:1)

这对我有用: 启动 cmd -> 导航到项目路径 -> 运行命令“gradlew clean build” -> 完成后重新导入 gradle 更改。

答案 3 :(得分:0)

这可能是由于项目中的依赖项引起的。

检查此线程:https://youtrack.jetbrains.com/issue/IDEA-202685#focus=streamItem-27-3265172-0-0

在我的项目中,当我运行gradle build时,我收到一条与错误依赖项有关的错误消息。解决特定问题后,gradle同步即可正常工作。

答案 4 :(得分:0)

文件路径:gradle \ wrapper \ gradle-wrapper.properties

将设置更改为:distributionUrl = https://services.gradle.org/distributions/gradle-5.5.1-bin.zip

答案 5 :(得分:0)

我在想法2019.3.2中有相同的例外。我删除了Idea设置(文件夹“ .idea”),然后从头开始再次设置项目。这为我解决了这个问题。

答案 6 :(得分:0)

在我的情况下,这是由于处于“离线模式”引起的。

就这么简单,退出离线模式就可以解决问题。

Offline mode button

答案 7 :(得分:0)

版本:2019.3.3 生成:193.6494.35

1禁用在IntelliJ设置中配置的代理。

2同步。

3重新启用已配置的代理。

4同步应该仍然有效。

答案 8 :(得分:0)

尝试删除本地Maven存储库并重新导入gradle项目,即

rm -rf ~/.m2/repository/*

然后重新导入。

答案 9 :(得分:0)

在我的情况下,由于Gradle.properties中的凭证缺少匹配,导致出现此错误。因此,我更新了凭据,问题已解决。

答案 10 :(得分:0)

我在Intellij版本2019.3.3中遇到了相同的问题 enter image description here

当我将intellij版本升级到2020.1.3时,

问题已得到解决