Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create an Android Studio plugin with Jewel? #326

Closed
mr-thierry opened this issue Mar 21, 2024 · 16 comments
Closed

How to create an Android Studio plugin with Jewel? #326

mr-thierry opened this issue Mar 21, 2024 · 16 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@mr-thierry
Copy link

mr-thierry commented Mar 21, 2024

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.

@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

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.

@rock3r rock3r self-assigned this Mar 21, 2024
@rock3r rock3r added the question Further information is requested label Mar 21, 2024
@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

You can look at how Package Search does it — their plugin works fine in Android Studio afaik.

@rock3r rock3r closed this as completed Mar 21, 2024
@mr-thierry
Copy link
Author

Also found this: JetBrains/intellij-platform-gradle-plugin#587

@mr-thierry
Copy link
Author

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. 😉

@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

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 😓

@rock3r rock3r reopened this Mar 21, 2024
@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

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

@rock3r rock3r added the documentation Improvements or additions to documentation label Mar 21, 2024
@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

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
Copy link
Author

@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

@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

Thanks for confirming!

@mr-thierry
Copy link
Author

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!

@rock3r
Copy link
Collaborator

rock3r commented Mar 21, 2024

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

@mr-thierry
Copy link
Author

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 🙂

@rock3r
Copy link
Collaborator

rock3r commented Mar 22, 2024

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.

@mr-thierry
Copy link
Author

Do you have a link to the issue? Will +1 it 🙂

@rock3r
Copy link
Collaborator

rock3r commented Mar 22, 2024 via email

@rock3r
Copy link
Collaborator

rock3r commented Aug 12, 2024

This will need to be solved at the IJP level (hopefully in 243). Closing, since work has moved on their side.

@rock3r rock3r closed this as completed Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants