Skip to content

Desktop Build

Stoat for Android has an experimental desktop build. It runs the shared Compose Multiplatform code on the JVM, so you get the same screens as on Android in a desktop window.

The desktop target is opt-in, so it never slows down mobile builds. Pass -Pstoat.desktop=true to Gradle to add the jvm() targets to :core:api, :core:designsystem and :shared, and to include the :desktop module.

To see :desktop in Android Studio, add this line to your user-level ~/.gradle/gradle.properties and sync:

stoat.desktop=true

You need JDK 17 or newer. The JDK that builds the Android app works.

Terminal window
./gradlew -Pstoat.desktop=true :desktop:run

The first run takes a few minutes while Gradle builds the JVM variants of each module.

Currently, you must log in with an existing account.
Registration needs an hCaptcha challenge, which the desktop build will not show yet.

The app keeps its database and settings in your user data folder:

OSFolder
Linux$XDG_DATA_HOME/Stoat or ~/.local/share/Stoat
macOS~/Library/Application Support/Stoat
Windows%APPDATA%\Stoat

Delete the folder to log out and start fresh.

To build a single jar you can run with java -jar:

Terminal window
./gradlew -Pstoat.desktop=true :desktop:packageUberJarForCurrentOS

Gradle writes it to desktop/build/compose/jars/.

For a smaller jar, build the release variant. It runs ProGuard, since Compose Desktop doesn’t support R8:

Terminal window
./gradlew -Pstoat.desktop=true :desktop:packageReleaseUberJarForCurrentOS

ProGuard only shrinks the release jar. Its optimiser produces bytecode the JVM rejects for large composables, so desktop/build.gradle.kts turns optimisation off. Keep rules live in desktop/proguard-rules.pro. If the release jar crashes with a missing class, method or enum constant that the plain jar has, the fix should be added to that file.

Both jars only run on the OS you built them on.

FeatureDesktop
Logging in, servers, DMs, groupsWorks
Reading and sending messagesWorks
Images, avatars, emojiWorks
SettingsWorks
↵ to send / ⇧↵ for newlineWorks
Pasting files and imagesWorks
Maths renderingShows KaTeX source
RegistrationNot supported (no hCaptcha webview)
Voice callsNo LiveKit, not supported
Push notificationsNot supported
Voice messages, recordingNot implemented
Audio and video playbackOpens in browser for now
GIFsNo video player, shows thumbnail
AttachmentsNo viewer, open in browser
Camera, QR scannerNot supported
YouTube and Apple Music embedsNo webview, not shown
DiscoverNo webview, shows a link
Language pickerAlways uses system language

Each expect declaration in common code needs a desktop actual in a jvmMain source set. A stub is fine: return a default, do nothing, or open the URL in the browser. The normal Android build doesn’t compile jvmMain, so check desktop yourself after you add an expect:

Terminal window
./gradlew -Pstoat.desktop=true :desktop:compileKotlin

Platform services that :app registers with Koin, such as VoiceCalls or PushNotifications, get desktop versions in desktop/src/main/kotlin/chat/stoat/desktop/DesktopServices.kt. Register new ones in desktopModule in Main.kt.

When a library works on Android but crashes on desktop with NoSuchMethodError or UnsatisfiedLinkError, check whether it ships a desktop artefact built against the Compose Multiplatform version this project uses.