0Day Forums
Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: Kotlin (https://zeroday.vip/Forum-Kotlin)
+--- Thread: Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' (/Thread-Cannot-access-39-java-lang-Object-39-which-is-a-supertype-of-39-org-gradle-api-artifacts-dsl-DependencyHandler-39)



Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' - mariscalp - 07-20-2023

Why is my build.gradle.kts file looking like this? This is a fresh Spring Boot project generated with start.spring.io. I already tried invalidate caches / restart, rebuild, resyncing and nothing works. Thanks in advance!

[![enter image description here][1]][1]


[1]:



RE: Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' - stepfather482 - 07-20-2023

This is what solved it:

1. Delete ~/.gradle/caches
2. Uninstall and Delete ~/Library/Application\ Support/Library/JetBrains/IntelliJIdea
3. Delete \<project dir>/.gradle
4. Delete \<project dir>/.idea
5. Start IDEA and reimport the project.


RE: Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' - kershner835 - 07-20-2023

I always had this issue in Android studio, but there is an easy way to solve it:

**replace default "Embedded JDK" with a path to the separately downloaded JDK**

For example in Android studio: Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JDK

After that, `Reload Gradle Project`.


RE: Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.dsl.DependencyHandler' - sluffs7632 - 07-20-2023

The IDE's JDK registrations are most likely inaccurate or outdated.
In my case this was in Android Studio and tied to a Toolbox issue. Whatever your case, the principle is the same.

## Option 1: Different JDK

Search for the "Gradle" page settings in Preferences, pick or download a different compatible JDK from the list, then run Gradle sync.

If that works, you know the problem. If you can just stick with the new one, great. If you need to fix the previous JDK (e.g. you're in Android Studio and want the embedded one), you will want to rebuild the JDK table.

## Option 2: Rebuild JDK Table

1. Shut down the IDE
2. Find and delete `jdk.table.xml` from your app's config directory (somewhere in `~/Library/Application Support/` or `%APPDATA%`)
3. Start up the IDE and let it finish indexing.
4. Return to Gradle preferences and specify your preferred JDK