Yohannlog
Yohannlog

Reputation: 221

IntellIj 2018.3 java.lang.AssertionError when refresh gradle project

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

Upvotes: 22

Views: 31764

Answers (15)

EpicPandaForce
EpicPandaForce

Reputation: 81539

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())

Upvotes: 1

Wassim Becheikh
Wassim Becheikh

Reputation: 19

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

Upvotes: 2

Mihai Timar
Mihai Timar

Reputation: 1160

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())

Upvotes: 2

paneer_tikka
paneer_tikka

Reputation: 6362

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!

Upvotes: 1

Roy
Roy

Reputation: 61

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

Upvotes: 6

keshav jois
keshav jois

Reputation: 89

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

Upvotes: 0

Bhargav
Bhargav

Reputation: 95

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.

Upvotes: 0

foo
foo

Reputation: 611

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

rm -rf ~/.m2/repository/*

and then reimport.

Upvotes: 0

Lucy Miracle
Lucy Miracle

Reputation: 11

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.

Upvotes: 1

trex
trex

Reputation: 573

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

Upvotes: 7

Sergey Khovrachev
Sergey Khovrachev

Reputation: 46

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.

Upvotes: 1

user12741484
user12741484

Reputation: 1

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

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

Upvotes: 0

Jérémy L.
Jérémy L.

Reputation: 121

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.

Upvotes: 1

squaleLis
squaleLis

Reputation: 6484

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.

Upvotes: 17

Izumi.H
Izumi.H

Reputation: 157

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

Upvotes: 4

Related Questions