JetBrains / skiko

Kotlin Multiplatform bindings to Skia
Apache License 2.0
1.8k stars 111 forks source link

Unable to run android studio plugins built with jetpack compose #71

Open samuelprince77 opened 3 years ago

samuelprince77 commented 3 years ago

I am working on an Intellij plugin project that targets both Intellij and Android Studio. I have built the UI entirely using compose and have been doing pretty much all my testing exclusively in Intellij. However, when i installed the plugin into Android Studio, it threw an exception when i executed it. The summarised error is:

com.intellij.diagnostic.PluginException: While loading class org.jetbrains.skiko.SkiaLayer: org/jetbrains/skiko/SkiaLayer has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I took a look at the runtime version of Android Studio, it is 1.8.0_242-release-1644-b3-6915495 x86_64. It seems that Skiko should have a jvm target flag to enable compatibility with Java 1.8.

Here is a link to a reproduce the issue. It is a modified version of the sample Jetpack compose plugin here but with changes to match my project settings.

https://gitlab.com/samuelprince411/compose-android-studio-plugin-bug

I used Android Studio 4.1.2 to reproduce this.

olonho commented 3 years ago

Use JDK11 or later, it is required for Compose for Desktop.

samuelprince77 commented 3 years ago

I was referring to running the plugin, since Android Studio is built using JDK 8, does it mean it is not possible to get compose plugins running there?

JatinVashisht1 commented 3 years ago

I was referring to running the plugin, since Android Studio is built using JDK 8, does it mean it is not possible to get compose plugins running there?

Did you found any solution to this problem?

quansb commented 2 years ago

please help

JatinVashisht1 commented 2 years ago

please help

I found out that it was a silly mistake from my side. All you have to do is when creating a new project select JRE instead of JDK in project configuration