https://kotlinlang.org logo
Title
j

John O'Reilly

05/29/2021, 12:43 PM
If I understand correctly, the android related dependencies are also pulled in as part of Compose Desktop build? If so, what's general approach used then to only depend on those for both?
j

Javier

05/29/2021, 12:52 PM
Just apply the JetBrains plugin and use built in deps under
compose
accessor
j

John O'Reilly

05/29/2021, 12:53 PM
Thanks @Javier, I'll try that
j

Javier

05/29/2021, 12:53 PM
the only problem is where you want to add libraries which doesn't match with JetBrains one
for example 0.4.0 rc is based on beta 08
meanwhile google is still on 07
so you have to downgrade your jb compose version or looking for a snapshot in androidx repo which uses beta08
Hope after beta this error disappears, if not can be hard playing with third party libraries if one person is using Google one and another JetBrains one :/
a

Albert Chang

05/29/2021, 1:18 PM
In beta API is stable so as long as there's no ABI change (such as that introduced in beta07) compatibility shouldn't be a problem.
j

Javier

05/29/2021, 2:07 PM
But I think it is a forced error
it checks the dependency and if it is not the same it fails
u

uli

05/29/2021, 3:18 PM
I hope compose web will also get Android dependencies soon
Or be included into compose desktop
a

Albert Chang

05/29/2021, 4:54 PM
@Javier I haven't seen that. How does the plugin know what version the dependency uses?
j

Javier

05/29/2021, 4:56 PM
I don't know how it does, but for example, if I add the jetbrains dependencies in the app module, and I add there the google ui tooling dependency to use
Preview
, if google/jetbrains are not pointing to the same version, it fails
So I had to point google one to an androidx snapshot version
Maybe @jim can help here about this limitation and if it will be removed when Jetpack Compose is stable, or if both have to be stable before removing it
a

Albert Chang

05/29/2021, 5:09 PM
So your "dependency" means compose itself right? That is understandable, since that's essentially different versions of the same library. This shouldn't prevent you from using other libraries that use compose.
j

John O'Reilly

05/29/2021, 5:19 PM
Tried this as a test, with a number of dependencies etc commented out (like tooling one), and was able to run Android app using that plugin and then adding these
implementation(compose.foundation)
    implementation(compose.material)
    implementation(compose.ui)
Using
2.4.0-alpha01
still of navigation compose library and also current accompanist lib
j

Javier

05/29/2021, 5:44 PM
Interesting 👀