jewel
jewel copied to clipboard
How to create an Android Studio plugin with Jewel?
If I set this:
intellij {
....
plugins.set(listOf("android"))
}
Apparently Android Studio has Jewel v0.11 already bundled (I'm targeting Android Studio Iguana | 2023.2.1 Patch 1
). When I run a simple plugin, I have the following error:
Caused by: java.lang.IllegalStateException: Can't add together different TextUnits. Got Unspecified and Sp
at org.jetbrains.jewel.ui.component.TypographyKt.plus-NB67dxo(Typography.kt:76)
at org.jetbrains.jewel.ui.component.Typography.h3TextStyle(Typography.kt:60)
Looking at the Gradle dependencies, I see that unzipped.com.jetbrains.plugins:android:unzipped.com.jetbrains.plugins:android-studio-AI-232.10300.40.2321.11567975
had the jewel-ui-0.11.0.jar
dependency.
This conflicts with my project settings.
Android Studio is not currently supported — I don't think it's supposed to ship Jewel yet, but there are some features we're working on that will use Jewel, so it may just be getting ready in advance.
To target Android Studio you currently would need to jarjar/shadow Compose and Jewel.
You can look at how Package Search does it — their plugin works fine in Android Studio afaik.
Also found this: https://github.com/JetBrains/intellij-platform-gradle-plugin/issues/587
Android Studio is not currently supported — I don't think it's supposed to ship Jewel yet, but there are some features we're working on that will use Jewel, so it may just be getting ready in advance.
To target Android Studio you currently would need to jarjar/shadow Compose and Jewel.
Would it be possible to put that IN ALL CAPS AND WITH A BIG FONT SIZE in the README? 🙂 (that would have avoid me wasting a day of development)
Especially since the video in the README file is from a Droidcon talk. 😉
Would it be possible to put that IN ALL CAPS AND WITH A BIG FONT SIZE in the README? 🙂 That's a very reasonable request :) Sorry, I hadn't thought of it before.
To be honest, I hope we'll manage to figure out a way to avoid leaking the Jewel/Compose dependency for Studio 3p plugins. I'll see if my colleagues can find a way! Dependencies are pretty complicated beasts in the IntelliJ Platform when you look at them from the 3p plugin perspective 😓
Reopened to remind me to add that notice to the readme, and hopefully to fix things in Studio dependencies so that Jewel doesn't leak to 3p plugins
I have filed an issue against Studio to try and sort out this dependency leak. @mr-thierry does this happen on Jellyfish, too? I would expect so, since the setup is the same.
@mr-thierry does this happen on Jellyfish, too? I would expect so, since the setup is the same.
Tried with Jellyfish 2023.3.2.1 and it has the same issue
Thanks for confirming!
You can look at how Package Search does it — their plugin works fine in Android Studio afaik.
I have download and ran the project. This project targets IntelliJ and not Android Studio. I does add a dependency to the Android Gradle plugin however. That may be enough for what I'm looking to do. Thanks for the suggestion!
Yeah, PKGS does target IJ but works fine in Studio (or used to! haven't checked in Studio in a while). They have the shadowing because the IJ platform at some point had a copy of Compose that was leaking, too, and that made it work, so I think it should indeed work for Studio until this is properly sorted
Follow-up on this for anyone looking for a solution to this issue: I ended up using the Jewel component that is currently shipping with Android Studio. While the version is quite old (v0.11), it's still better than using Swing IMHO 🙂
I have added a note in the readme mentioning this. https://github.com/JetBrains/jewel/blob/main/README.md#branching-strategy-and-ij-platforms
Will update when there are news on the Studio side.
Do you have a link to the issue? Will +1 it 🙂
Unfortunately there is no public component yet since we haven't shipped the feature yet... So it's private for now :(
But the right people is aware!
This will need to be solved at the IJP level (hopefully in 243). Closing, since work has moved on their side.