20

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

Yohannlog
  • 201
  • 1
  • 2
  • 4

13 Answers13

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.

Community
  • 1
  • 1
squaleLis
  • 6,116
  • 2
  • 22
  • 30
  • 4
    I'm getting this error in CE 2019.3, but I don't see the configuration as you have described – Kevin Koshiol Dec 12 '19 at 16:25
  • 2
    Confirmed, mentioned options do not exists for Intellij IDEA 2019.3. Hence, mentioned solution is not working anymore – n0noob Feb 19 '20 at 10:12
6

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

trex
  • 325
  • 3
  • 8
4

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

Izumi.H
  • 147
  • 1
  • 4
4

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

Roy
  • 41
  • 1
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.

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.

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.

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!

paneer_tikka
  • 6,232
  • 1
  • 20
  • 17
0

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

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

0

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

rm -rf ~/.m2/repository/*

and then reimport.

foo
  • 574
  • 8
  • 13
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.

Bhargav
  • 85
  • 1
  • 9
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

keshav jois
  • 71
  • 1
  • 2
0

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())
Mihai Timar
  • 1,141
  • 13
  • 21