13

I'm starting a project using the KorGE library, and I would like to use Retrofit as XML parser. So I try to follow this guide, which seems fine, but I just poorly get stuck by adding the dependencies in the first step.

I already have the KorGE libraries included (I started from the template):

dependencies {
    classpath("com.soywiz.korlibs.korge.plugins:korge-gradle-plugin:$korgePluginVersion")
    classpath("com.soywiz.korlibs.klock:klock:1.6.1")
}

But when I try to includes the following dependencies, everything turns to hell when I load gradle changes (I guess this is the way I should declare them?):

classpath("com.squareup.retrofit:retrofit:2.4.0")
classpath("com.squareup.retrofit:converter-simplexml:2.4.0")

In the guide it seems that this dependencies are part of APIs, but I did not found anything different about declaration on the net. If I just copy-past it obviously doesn't work.

The errors I get after loading gradle changes:

java.lang.IllegalArgumentException: org.gradle.api.internal.initialization.DefaultClassLoaderScope@a2e5ac5 must be locked before it can be used to compute a classpath!
java.lang.IllegalArgumentException: project.classLoaderScope must be locked before querying the project schema

Thank you very much in advance for your help guys, and sorry for my noobiness.

Martin Brisiak
  • 3,872
  • 12
  • 37
  • 51
vsilaire
  • 131
  • 1
  • 5
  • 1
    It may be related to this issue: https://github.com/gradle/gradle/issues/4823. I had the same effect because I use kotlin dsl with windows, many app modules in nested directories and with enabled `org.gradle.configureondemand=true` in main `gradle.properties` – wrozwad Aug 24 '21 at 07:45

2 Answers2

5

Removing org.gradle.configureondemand=true in ~/.gradle/gradle.properties solved it for me.

user2403257
  • 51
  • 1
  • 2
-1

Solution worked for me

I was also facing this issue, and I didn't find a solution. This below solution worked for me.

Cause:

I was using kotlin build.gradle. And I was using below

classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")

Where kotlinVersion was in another class & it was imported like

import DependenciesVersions.kotlinVersion Which was causing issue.

Solution:

Remove import line from build.gradle.kts Use your version like this

classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${DependenciesVersions.kotlinVersion}")

And now sync project, it will work.

Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212