A minimal mobile Go example packaged for Android using gomobile bind.
engine.go— app startup and runtime registration, not meant to be tampered unless you are suremain.go— backend service withAppService.SayHellofrontend/— embedded web UI assetsandroid/— local Android build helper scripts
After editing or write your Go code, you must refresh or sync first to produce native bindings.
Update android.ini to control architecture, Android API, output path, and template SDK values.
wailsm --refresh android # or ios
The script will:
- build the example AAR with
gomobile bind - dump the generated
.aarand source.jarintonative/android/app/libs
Once again: don't forget after editing or write your Go code, you must refresh or sync first to produce native bindings.
Now open the project in Android Studio or XCode.
Where the resulting projects are found:
- Final Android Studio project:
native/android/ - Final XCode:
native/...
External plugins are just external Go packages, with the directory structured in such a way Wails Mobile CLI can realize it contains some native platform code.
Sample Plugin structure:
somePlugin/
- android/
- com/.... #example package name
- ios/
- ...#support coming soon
- go.mod
- other go package filesYou can add a plugin with:
wailsm --add github.com/<handle>/<plugin> # uses `go get...` under the hoodYou can remove a plugin from Wails mobile with:
wailsm --remove github.com/<handle>/<plugin>You can design an external plugin to be integrated into Wails Mobile application, or even write some app-specific native Java or Swift code and call it from Go.
Instructions on achieving this goal is wired in [PLUGINS.md](PLUGINS.md)
- The WebView frontend uses
WailsBind.callGo(...)to invoke the Go backend. - Currently,
wails-mobileis stable enough for Android builds. If you care to get support for iOS sooner, contribute by translating the Java project into Swift project. - The core bridge in Go is cross-platform(
AndroidandiOS). No writing of JNI. No writing of C code and headers.