IntellIj 2018.3 java.lang.AssertionError when refresh gradle project
Asked Answered
I

15

22

I have a problem since 2 days with intellij. When I refresh gradle project, I have an error in the console and I used Java 11.

I search everywhere but few people have this problem.

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

Someone can help me ?

Yohann

Irmine answered 23/11, 2018 at 7:49 Comment(4)
Did you try to invalidate the cache ?Godderd
Yeah, but nothing changeIrmine
Sounds like youtrack.jetbrains.com/issue/IDEA-202685Buprestid
Ho ok, It's a recent problem. I see.. ThanksIrmine
C
18

This is the ticket of the error (as spotted by Petr Rastegaev in the comments of the question):

In the thread, I found this workaround that worked for me:

Settings -> Build -> Gradle -> "Create separate module per source set"

checked fails, unchecked is ok.

Cantone answered 9/1, 2019 at 15:6 Comment(2)
I'm getting this error in CE 2019.3, but I don't see the configuration as you have describedBlessing
Confirmed, mentioned options do not exists for Intellij IDEA 2019.3. Hence, mentioned solution is not working anymoreArrest
M
7

In my case it was caused due to being in "offline mode".

Simply enough, going out of offline mode did the trick.

Offline mode button

Mountain answered 5/3, 2020 at 16:1 Comment(1)
it was for my network issue too, Iranian must use VPNHarpsichord
O
6

This worked for me: Launch cmd -> navigate to the project path -> run the command "gradlew clean build" -> once done reimport gradle changes.

Ollie answered 8/3, 2021 at 16:57 Comment(0)
V
4

I had the exact same issue and had to downgrade IntelliJ to 2018.2 to fix it.

Vivyan answered 11/12, 2018 at 17:48 Comment(1)
I didn't have the exact same issue but quite a similar one - this solved it for me, so +1Samovar
B
2

I've encountered this recently on AndroidStudio 2022.3.1

In my case it was a sub project with a weird path. It's sitting next to the root project and i have a symlink in a subfolder that points to it. Not sure which of the two causes the issue, or if it's the combination.

The fix was changing how the subproject is included, from:

includeBuild("path/with/symlink/pointing/outside/project-root/folder")

to:

includeBuild(file("path/with/symlink/pointing/outside/project-root/folder").toPath().toRealPath().toAbsolutePath().toString())
Batrachian answered 28/8, 2023 at 8:3 Comment(0)
D
2

Click the button next to device manager called "Sync Project with gradle files".

Donothing answered 9/10, 2023 at 17:39 Comment(0)
R
1

This probably comes from a problem regarding a dependency in your project.

Check this thread : https://youtrack.jetbrains.com/issue/IDEA-202685#focus=streamItem-27-3265172-0-0

In my project, when I run gradle build, I have an error message related to the dependency in error. After solving that particular issue, gradle sync works normally.

Receptive answered 30/1, 2019 at 12:18 Comment(1)
I had to use https for repo1.maven.org instead of http.Infarction
S
1

I had the same exception in idea 2019.3.2. I removed Idea settings (folder “.idea” ) and set up project again from scratch. That fixed the issue for me.

Savino answered 4/2, 2020 at 11:3 Comment(0)
D
1

Version: 2019.3.3 Build: 193.6494.35

1 Disabling the proxy configured inside IntelliJ settings.

2 Sync.

3 Re-enable the configured proxy.

4 Sync should still work.

Delagarza answered 11/3, 2020 at 9:6 Comment(0)
K
1

I was getting this error on a react-native project. My project ran fine using react-native run-android but Android studio failed to finish gradle sync with the above exception.

TLDR;

In my case, it was caused by react-native-gradle-plugin that was being included from settings.gradle. This got added as a result of upgrading react to 0.69 in my project.

I was able to comment out the following to finish gradle sync:

  1. In settings.gradle
//includeBuild('../node_modules/react-native-gradle-plugin')
  1. In android/build.gradle
//        classpath("com.facebook.react:react-native-gradle-plugin")

I tried installing react-native-gradle-plugin with yarn and tried adding the classpath, but that quickly snowballed into version incompatibilities between gradle version needed by the plugin and Android studio. I'm not sure what side effects this commenting out has, but I haven't noticed any!

Kennykeno answered 6/12, 2022 at 7:38 Comment(0)
L
1

As per https://youtrack.jetbrains.com/issue/KTIJ-23971/IDE-Gradle-import-Exception-during-working-with-external-system-java.lang.AssertionError-with-symlinks-and-React-Native#focus=Comments-27-8101997.0-0

Replace

includeBuild('../node_modules/react-native-gradle-plugin')

with

includeBuild(file('../node_modules/react-native-gradle-plugin').toPath().toRealPath().toAbsolutePath().toString())
Lockup answered 27/5 at 8:4 Comment(0)
S
0

file path : gradle\wrapper\gradle-wrapper.properties

change the setting to: distributionUrl=https://services.gradle.org/distributions/gradle-5.5.1-bin.zip

Syntax answered 19/1, 2020 at 10:0 Comment(0)
X
0

Try removing the local maven repository and re-importing the gradle project, i.e

rm -rf ~/.m2/repository/*

and then reimport.

Xerography answered 9/4, 2020 at 20:32 Comment(0)
C
0

In my case I got this error due to credentials miss match in the Gradle.properties. So I have updated the credentials and the issue was resolved.

Capper answered 8/7, 2020 at 4:46 Comment(0)
M
0

I had faced the same issue in Intellij version 2019.3.3 enter image description here

issue was fixed when i upgraded the intellij version to 2020.1.3

Mediation answered 19/7, 2020 at 23:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.