After my intensive dive into tooling and doing tec...
# multiplatform
a
After my intensive dive into tooling and doing tech explorations, am seriously wondering, is it worth building both a pure Android and a CMP version at the same time, just to get vastly better previewing
c
You can preview common compose if you place the previews int the androidDebug source, but yes a bit cumbersom, fleet suposedly supports it in common code. They are working on better preview in common code from what I am aware of, ui testing has gotten much better, ironically, android being the worst platform to run pure compose ui tests on. (Forced to run them on androidConnectedTests)
a
You can preview common compose if you place the previews int the androidDebug source
Yep but same problem as for Fleet that resources
Res.drawable…
don’t work, Android expecting
R.drawable…
A source of major confusion - those resource failures show up in the IDE as “Render Problem” in Android Studio. At least in Fleet you can see the log in Details and that it’s the failure to load the icon. This has taken me a couple of days to realise that was all that was going wrong.
t
Also lately for me Fleet previews freeze after changing the content 3 or 4 times. Is this common or just with me?
a
Not seeing freezes here (with Desktop Preview) in Fleet 1.40.87 running on a fairly grunty MacBook 16" M3 Pro with 36GB RAM
a
ironically, android being the worst platform to run pure compose ui tests on. (Forced to run them on androidConnectedTests)
not true, you can use robolectric for your UI tests, we use them and work quite well 😄 if i understand you correctly
c
Actually thought about trying that never got there, you saying these work with robolectric setup? https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-test.html#write-and-run-common-tests
Fleet isn't freezing, but Fleet backend will peg the CPU "doing nothing", so I'm guessing a memory leak or bug causing runaway
Also released an update today, which looks like some fixed perf issues
My issue with fleet is that most of the keycommands don't work from intellij (also no copilot support yet)
t
@chrisjenx did you change your settings for shortcuts to be intellij? To be honest idk why they create a new one instead of using the same as intellij but good we have the option at least
c
yeah I did, it's minor things tbh, I hate tab based commit, I prefer the dialog, swiping back on my trackpad doesn't work (but cmd [] does etc)
Commit window doesn't auto stage, really it's mostly small things for me, if they fixed a couple of them I could probably move over
(I have reported them all, they seem pretty staunch on not providing a commit dialog for some reason, I try to have as much space dedicated to code, so things taking up sides and bottom is never going to sit well, know many other devs in the same space) I'm trying to reduce my ADD not increase it LOL
a
oh i misunderstood. the
runComposeUiTest
function - we dont use that. just pure compose test rule from junit.
👍 1
k
@Andy Dent, if I understand it correctly, Android’s preview should work with
Res.drawable
according to this change: https://github.com/JetBrains/compose-multiplatform/pull/4965 however, in my case, it fails to render a preview without any error message on the latest CMP and Android Studio version
a
Thank You! @KamilH • edited
libs.versions.toml
changing compose-plugin = “1.7.0-alpha01” • (slow) resync • Android preview (from
MainActivity.kt
looked unchanged, not showing image) • Build - Clean Project (possibly unnecessary) • Ran an Android simulator, which worked (as it had been all along), showing image • Go back into
MainActivity.kt
and yes the preview now shows the image with a path
Res.drawable.compose_multiplatform
Confirmed in Fleet 1.41 that the Android Preview is also now showing an image kodee happy
https://github.com/AndyDentFree/kotlyrical/tree/main/PreviewablePic if anyone wants a really trivial sample exploring this
👍 1
blob ty sign 1