This page was machine-translated from Portuguese and may contain errors. The Portuguese version is canonical.
12. Shipping
What you will learn: close the cycle — package the app for each platform. Prerequisites: Testing your app.
Complete example (copy, paste and run)
The entry point that Main instantiates by classname (reflection, no-args constructor) — the same
core runs on the four launchers. This minimal, self-contained MainWindow is what each target packages.
Compiles as is.
package com.exemplo;
import dev.crossfly.ui.*;
import dev.crossfly.ui.layout.*;
public class MainWindow extends Window
{
@Override
public void onShow() throws Exception
{
super.onShow();
setLayout(new VerticalLayout());
add(LAY_AUTO, new Label("Meu app CrossFly"));
Button ola = new Button("Olá, mundo!");
ola.onAction(c -> Hint.show("Rodando em todas as plataformas", 2000));
add(LAY_AUTO, ola);
}
}
The snippets below show only the core (what goes inside
onShow()). To run them, place them in theMainWindowskeleton above.
One codebase, four targets
The same core runs on every launcher:
| Target | Build |
|---|---|
| 🖥️ Desktop | gradlew :lwjgl3:run (dev) / jar / installer |
| 🤖 Android | gradlew :android:installDebug / assembleRelease (AAB) |
| 🍎 iOS | gradlew :ios:launchIPhoneSimulator / .ipa (macOS+Xcode) |
| 🌐 Web | gradlew :web:webBundle → static content |
What the bootstrap guarantees
Main instantiates your MainWindow by classname (reflection, no-args constructor) — the same on
every target. Icons and assets (Roboto/Material fonts are loaded at bootstrap) ship with the
package.
“Ready to ship” checklist
- Tested (ch. 11) and responsive (ch. 10).
- Features unavailable per platform handled (see matrix).
- Permissions:
AndroidManifest.xml/Info.plist. - Signing (Android keystore / iOS provisioning).
- Icons, launch screen, version.
End of the course — what now?
You built an app that opens, adds, navigates, persists, adapts and is tested — and you packaged it. From here:
- Dig into the “why”:
concepts/. - Quality at scale:
best-practices/. - Detailed publishing:
platforms/. - One-off tasks:
cookbook/·ui/·data-and-services/.
Recap
One core, four Gradle launchers; MainWindow by classname; a per-platform release checklist.
See also
- Build and distribution · Canonical source: Chapter 4 §4.2