joreilly / PeopleInSpace

Kotlin Multiplatform project with SwiftUI, Jetpack Compose, Compose for Wear, Compose for Desktop, and Compose for Web clients along with Ktor backend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel

DaFaack opened this issue · comments

Can't open the project on my mac, tried following Android Studio versions:
Arctic Fox 2020.3.1 Beta 2
Android Studio 4.2
Android Studio 4.2.1
Bumblebee 2021.1.1 Canary 1

I'm running into following error as soon as I try to build the app from version controll:

java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
	at org.jetbrains.kotlin.com.intellij.core.CoreLanguageLevelProjectExtension.<init>(CoreLanguageLevelProjectExtension.java:26)
	at org.jetbrains.kotlin.com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:42)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.<init>(KotlinCoreProjectEnvironment.kt:26)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.<init>(KotlinCoreEnvironment.kt:118)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:420)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:226)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:152)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:371)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:249)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:38)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:602)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:93)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1644)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:831)

An older version of PeopleInSpace works fine on Android but I also run into a problem on Xcode:
Cannot find 'KoinKt' in scope

I just tried fresh clone of repo, opened in Arctic Fox beta2, and Android/iOS clients for example both seem to build/run ok. What was the "older version" that you tried?

I see some discussion around that error in following....not sure if it's maybe related https://youtrack.jetbrains.com/issue/KT-45566. What version of JDK are you using? BTW I was hoping to update this repo (and others) soon to have Arctic Fox (and associated gradle plugin) as minimum required........maybe if you were to try those changes there as test? (think you should get prompted for them to be made when you open project in that version of AS)

I've just pushed change to starting using com.android.tools.build:gradle:7.0.0-beta02 etc. Can you try that out and see if you're still seeing same issue with that?

Thanks for the link, updating from Kotlin version 1.4.32 to 1.5.0-RC fixed the error but compose version 1.0.0-beta06 isn't compatible with Kotlin 1.5.0-RC.

e: This version (1.0.0-beta06) of the Compose Compiler requires Kotlin version 1.4.32 but you appear to be using Kotlin version 1.5.0-RC which is not known to be compatible. Please fix your configuration (or suppressKotlinVersionCompatibilityCheck but don't say I didn't warn you!).

EDIT:
Sounds bizarre but upgrading to Kotlin Version 1.5.0-RC and downgrading back to 1.4.32 fixed the error for me.
I also had this problem in the FantasyPremiereLeague project, with this single up and downgrade in the PeopleInSpace project the error in FantasyPremiereLeague also disappeared.

hmm, strange....I have a branch that I've been making 1.5 related changes to but certainly right now main branch shouldn't work with 1.5. Compose beta08 is due out on June 2nd and that will support 1.5....hope to be able to merge those changes then.

@DaFaack are you still seeing this with latest code?

Just checked out the latest code, everything works fine!
Thank you very much

I have this issue now, Xcode 13.2, latest main branch (f0a0cb5), and I am in the dark about why this happens. For what it's worth, same machine, same setup, KaMPKitiOS compiles and works. I am exploring the differences now between the two projects, but apart from one using "common" and the other using "shared" for the name, and apart from KaMPKitiOS specifying a minimum deployment target in the podspec, I can't seem to find any reason why one project would compile and the other not.

I have also been bisecting but could not find a good commit until more than a year ago (70725a2) - of course I have not tried all commits, and at least once the error message was different (but equally ununderstandable).

I strongly suspect something is wrong with my setup, but I am new to gradle, only getting to know Kotlin, and haven't touched Java since a long time ago.

Any ideas are appreciated.

fwiw I'm also using XCode 13.2 here. Is this on m1 device or not (though should work on both)? Do you know what version of JDK is installed?

From https://youtrack.jetbrains.com/issue/KT-45566 it looks like other people are still running in to this issue. I see a few references to jdk and gradle versions being a factor.

This is not on a M1 device, just a "regular" intel MacBook Pro. Adding java --version in the common build script gives:

java 17.0.1 2021-10-19 LTS

Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)

Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

FWIW I also deleted .gradle file, but it did not work. Some people also said to change kotlin version, which I did in IntelliJ / Tools / Kotlin / Configure Kotlin Plugin Updates, but that did not seem to make a difference (it is not clear to me how gradle acesses the Kotlin plugin, is that via the Java SDK?)