Using the app: see the user guide. This file is about building it.
The native Android app for Skywire: a Kotlin / Jetpack Compose (Material 3)
shell around the Skywire mobile core — a single Go binary
(libskywire-mobile.so) bundling the visor, config generation, and the four
client apps (skychat, skysocks-client, vpn-client, skydex-client), which run
in-process inside the visor. The app drives the core through the visor's
authenticated local REST API on 127.0.0.1:8000.
This directory is a self-contained Gradle project; Android Studio opens
android/, not the repo root. The Go payload is built by the repo-root
Makefile and lands in app/src/main/jniLibs/arm64-v8a/ (gitignored — always
rebuilt, never committed).
| Tool | Notes |
|---|---|
Go (see repo go.mod) |
builds the core payload |
| Android SDK | platform + build-tools; Android Studio installs these |
| Android NDK | for the release payload lane (android-mobile-ndk) and the x86_64 emulator lane (android-mobile-x86_64) |
| Android Studio (or any JDK 17+) | Gradle needs JDK 17+; Studio's bundled JDK works. The Makefile defaults to it via ANDROID_JAVA_HOME |
| A device or AVD | arm64, or an x86_64 emulator image with make android-mobile-x86_64 (debug builds only; release stays arm64) |
android/local.properties (gitignored) must point at your SDK:
sdk.dir=/Users/<you>/Library/Android/sdk
Android Studio writes this automatically on first open.
Everything runs from the repo root:
# 1. The Go core payload → android/app/src/main/jniLibs/arm64-v8a/libskywire-mobile.so
make android-mobile # pure-Go lane: CI + emulator work
make android-mobile-ndk # NDK/cgo lane: RELEASE builds (fixes Android DNS via
# bionic getaddrinfo); needs ANDROID_NDK_HOME set
make android-mobile-check # pure-Go build + the CI size budget (fails > 80 MB)
make android-mobile-x86_64 # NDK/cgo android/amd64 core for an x86_64 emulator; debug
# APKs carry it, release APKs do not
# 2. The APK
make android-apk # release (unsigned until release signing lands)
make android-apk-debug # debug-signed → installable directly via adbOr with Gradle directly (JAVA_HOME must be a JDK 17+):
cd android && ./gradlew assembleDebugAPKs land in android/app/build/outputs/apk/{debug,release}/.
Rule of thumb: whenever the Go side changed, run make android-mobile
(or -ndk) first, then rebuild/reinstall the APK — Android Studio's Run ▶
does not rebuild the payload.
Android Studio (the normal dev loop): open android/, pick the device or
AVD, Run ▶.
CLI:
make android-apk-debug
adb install -r android/app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n com.skycoin.skywire/.MainActivityEmulator: the project AVD is named skywire (Pixel-class, arm64,
google_apis). If it doesn't exist yet:
sdkmanager "system-images;android-37.0;google_apis;arm64-v8a"
avdmanager create avd -n skywire -k "system-images;android-37.0;google_apis;arm64-v8a" --device pixel_7
emulator -avd skywireEmulator networking is NATed — the core's outbound dmsg/transport dialing works out of the box.
Home's Connect starts SkywireCoreService (a specialUse foreground
service) which execs libskywire-mobile.so from nativeLibraryDir as a
child process — the phone equivalent of skywire visor -c skywire-config.json
under a supervisor:
- First run: the service runs the payload's own
config gen(keys made on-device, never leave it), then applies the phone profile in Kotlin (core/ConfigManager.kt): API pinned to127.0.0.1:8000with auth, RPC listener off,pty/skywire-tcp/lan_dmsg_serverremoved, all paths underfiles/skywire/, all apps in-proc with autostart off. The profile is re-applied on every start, so the pins survive config rewrites and app updates. - Auth: single
adminaccount with a random device-local password (AndroidKeyStore-encrypted at rest,core/SecretStore.kt); the client (api/VisorApi.kt) creates the account on first run and re-logins on 401 (visor restarts invalidate sessions). - Lifecycle: crash → restart with backoff (1 s → 30 s, reset after a
stable minute); Disconnect → SIGTERM via
Os.kill(Android'sProcess.destroy()is SIGKILL and would skip the visor's graceful shutdown), escalating only if it hangs. Swiping the app away does not stop the core; Disconnect or Force stop does. - Process log: the child's combined output lands in
files/skywire/skywire-process.log(rotating) — readable in-app via the log viewer's Process source, which works even when the visor won't start.
Each app screen drives one of the visor's apps over the local API — list,
configure, start, observe — and carries a Logs action scoped to that app.
SkySOCKS (ui/socks/) lists public proxy servers from service discovery
(/api/svc-fetch?service=sd&path=/api/services?type=proxy, which the visor
fetches over DMSG on the app's behalf), points skysocks-client at the tapped
one (PUT …/apps/skysocks-client with pk, then status), and polls
…/apps/skysocks-client + …/connections for state and traffic. The chosen
server is remembered across restarts, so the screen opens on a one-tap
Reconnect.
Two of the app's flags are owned by the phone profile rather than the screen,
and re-pinned on every launch (core/ConfigManager.kt):
--addrhost is forced to127.0.0.1— the generated:1080listens on every interface, which on a phone means any device on the same Wi-Fi could use the proxy. The port stays editable from the screen.--reconnectis always on. Phones lose mesh routes routinely (a cell handover is enough); without it the app exits when its route group dies and the proxy is silently dead until the user notices.
Starting or reconfiguring goes through an explicit stop first: the visor's
restart-on-args-change races the outgoing proc, whose blocked accept returns
"use of closed network connection" and leaves the app stuck in Errored.
SkyVPN (ui/vpn/ + core/SkyVpnService.kt) repeats that shape against
type=vpn and routes the whole phone. An app may never open
/dev/net/tun, so the interface is created by SkyVpnService through
VpnService.Builder and its file descriptor is passed to the visor process
over an abstract unix socket as SCM_RIGHTS ancillary data. The Go end is
pkg/vpn/tun_device_android.go, which documents the (newline-delimited JSON)
protocol; pkg/vpn/os_client_android.go is the Android spelling of the route
and DNS calls the shared client makes — Builder declares all of it, so
SetupTUN is the whole configuration and deleting the default route means
dropping the interface.
Three things are worth knowing before changing any of it:
addDisallowedApplication(self)is not optional. The visor is a child of this app and shares its UID, so without the exclusion its dmsg traffic — the traffic carrying the tunnel — would be routed into the tunnel.- The service keeps its own copy of the descriptor, so the interface
outlives the core closing its copy. That is what makes
--killswitchreal: the tunnel drops, nothing drains the interface, packets go nowhere. It is released on an explicitdown, on a control-socket EOF with the killswitch off, or on disconnect — never on a visor crash-restart. - The killswitch is set through the API's
killswitchfield, not by rewriting argv; the visor owns both spellings. The phone's stored preference wins and is re-applied whenever the core comes up.
The VPN hotspot (core/VpnHotspot.kt + pkg/vpn/share*.go) shares the
tunnel with devices on the phone's hotspot, as an HTTP + SOCKS5 proxy on port
8118. Tethered traffic is forwarded below VpnService and no app without root
can pull it in, and this app is excluded from its own tunnel, so neither side
can just forward. The app listens, keeps only connections that arrived on a
hotspot interface (not a network the phone is joined to), and passes each
socket to the visor as an SCM_RIGHTS descriptor on a second abstract socket.
vpn-client proxies it from a gVisor netstack that uses the tunnel's own
address, so the server's per-client rules still apply. Replies are split from
the kernel's by destination port: the netstack's ephemeral range is
61000–65535, above Linux's 32768–60999.
SkyChat (chat/ + ui/chat/) is native Compose over skychat's own HTTP
API on 127.0.0.1:8001, the same surface the desktop page uses. chat/
holds the client (SkychatClient), the /sse follower (SseDispatch) and
ChatRepository, which keeps every conversation and does what the page did
in the browser: DM threads cached on disk with their delivery ticks, unread
counts, read receipts, the peer link before a send, and the /notify-focus
lease that stops skychat notifying about the thread on screen. Saved
Messages, contact pictures, pins, mutes and the other preferences live under
files/skychat-native/<visor pk>/. The first run after an update copies them
out of the old page's WebView storage (LegacyImport).
Mutes and the preview switch are applied in NotificationBridge, since the
visor hub is what posts chat notifications on a phone. Voice messages are
recorded with MediaRecorder (Ogg/Opus), video messages with CameraX plus a
separate AAC track muxed in, because some camcorder profiles pair video with
AMR audio that no browser plays. Both use the voice- and video- file name
prefixes every skychat UI reads.
SkyDEX (ui/dex/) is native screens over skydex-client's own control
API at 127.0.0.1:8051 (api/SkydexApi). Connecting writes --market-pk
into the app's argv (PUT …/apps/skydex-client with args, then status —
pk is allow-listed to skysocks/vpn and would be rejected), starts the app,
and POSTs /api/connect, because the engine never dials on its own. From
there the tabs (Market, My Orders, My Listings, History, Settings) make the
same calls the web trading page made: skydex-client passes each one to the
market over dmsg and the market stays the source of truth. Polling runs only
while the screen is in front, and when a call fails because the dmsg stream
behind the connection closed, the screen dials the market again once.
What the page kept in localStorage lives in dex/DexStore: the addresses to
pre-fill, and finished trades, which the market deletes after its cleanup
window. History is keyed by side and order id, because the market lets a
seller buy their own product and then reports the one order twice. The old
page's storage is moved over once by dex/DexLegacyImport, the same hidden
WebView read as the chat's.
core/SkydexProfile pins two flags on every launch:
-
--addrhost to127.0.0.1, as for the proxy. -
--password-file, holding a device-local secret. The trading UI ships with no authentication, and on Android a loopback listener is reachable by every app holding INTERNET — with the live market session, the registered wallet addresses and order placement behind it. The gate is skywire's own (cmd/apps/skydex-client/commands/auth.go): with a password set the wrapper serves basic auth on--addrand moves the vendored engine to a loopback port drawn fresh at every start. Off by default, so desktop is unchanged.It closes the documented port, not the engine's own: that answers ungated to anything that scans for it. Closing it fully needs
skydexclient.Runto accept anet.Listenerupstream, after which the proxy becomes a handler wrapper and the second port disappears.
App logs:
adb logcat --pid=$(adb shell pidof -s com.skycoin.skywire)The visor's own logs, in-app: Home → View logs (core ring buffer while the API is up, the captured process output otherwise).
The core's local API from your desk (once the app runs the core — or with the payload run manually, below):
adb forward tcp:8000 tcp:8000 # http://127.0.0.1:8000/api/ping → "PONG!"
adb forward tcp:1080 tcp:1080 # your desktop browser rides the phone's SOCKS5
curl --socks5-hostname 127.0.0.1:1080 https://example.comSkySOCKS end-to-end, entirely on the phone (the device ships curl, and the
shell runs as a different UID — so this is the same reachability a third-party
app gets):
adb shell 'curl -s https://api.ipify.org; echo' # your real IP
adb shell 'curl -s --socks5-hostname 127.0.0.1:1080 https://api.ipify.org; echo' # the exit node'sThe API is authenticated (session cookie) and CSRF-protected: GET /api/csrf
→ send the token as X-CSRF-Token on every mutating request. /api/ping is
open; everything else needs POST /api/login first.
Payload-only smoke (no app involved) — run the core straight from a shell, useful to bisect "app problem vs core problem":
adb push android/app/src/main/jniLibs/arm64-v8a/libskywire-mobile.so /data/local/tmp/skywire/
adb shell
cd /data/local/tmp/skywire && chmod +x libskywire-mobile.so
./libskywire-mobile.so config gen -i -e -o ./skywire-config.json --binpath /data/local/tmp/skywire
# apply the phone-profile edits (see the desktop smoke notes in the repo), then:
./libskywire-mobile.so visor -c ./skywire-config.jsonHost-side unit tests are the ones that state facts about the sources rather
than about a running app — the manifest not handing the lock screen to every
screen (ManifestKeyguardTest), and the string catalogues staying complete and
formattable (TranslationCatalogTest, AppLanguageTest). Run them with
./gradlew :app:testDebugUnitTest. Go-side tests run from the repo root as
usual (make test); the mobile build variant is compile-checked in CI by
the android job with a size budget.
The interface ships in English and Simplified Chinese, chosen in Settings ▸
Language and remembered per app. On Android 13+ the platform owns that choice
(it is the same setting as Settings ▸ Apps ▸ Skywire ▸ Language); below 13 it
lives in the app's own prefs and every Activity and Service picks it up by
wrapping its base context. Both paths are behind core/AppLocale.kt.
Only the app's own interface is translated. Logs, the visor's own output and anything quoted from a process or an HTTP response stay in English — they are read next to a desktop's and matched against the Go source, and a translated log line is one nobody can search for.
Adding a language is three edits and nothing else:
app/src/main/res/values-<tag>/strings.xml— every translatable string fromvalues/strings.xml. Chinese has one plural category (other); check what yours has before copying a<plurals>.- A constant in
core/AppLanguage.ktwith the language's BCP-47 tag, and its name in its own script as atranslatable="false"string (settings_language_zh_cnis the pattern). The picker builds itself from the enum — the Settings screen needs no edit. - The tag in
app/src/main/res/xml/locales_config.xml, which is what Android 13+ reads to list the app in its own language settings.
TranslationCatalogTest then holds all three together: it fails the build if a
string is missing from a translation, if a translation asks for a format
argument the call site does not pass, or if the enum, the values folder and
the locale config disagree about what is shipped.
android/
├── settings.gradle.kts / build.gradle.kts / gradle/libs.versions.toml
├── gradlew, gradle/wrapper/ # committed wrapper (Gradle 9.6)
└── app/src/main/
├── AndroidManifest.xml
├── java/com/skycoin/skywire/
│ ├── MainActivity.kt # the one Activity: splash → gate → scaffold
│ ├── core/ # foreground service, config, secrets, prefs
│ ├── api/ # local-API client + DTOs
│ ├── chat/ # SkyChat client, event stream, local store
│ ├── dex/ # SkyDEX local store, legacy import
│ └── ui/ # theme/, navigation/, components/, logs/,
│ # home/ chat/ hub/ socks/ vpn/ dex/
│ # fleet/ wallet/ settings/
├── res/ # brand logo (drawable-nodpi), Skycoin
│ # fonts (font/), splash + adaptive icon
└── jniLibs/arm64-v8a/ # Go payload (gitignored build artifact)
The store listing F-Droid shows (title.txt, the descriptions, the icon and
the per-version changelogs) is not under android/: it lives at the repo root
in fastlane/metadata/android/en-US/, because fdroidserver looks for it only
in the repo root, the recipe's subdir (android/app) and src/<flavor>/.
Progress log: implementation-report.md.
Tag the commit mobile-vX.Y.Z and push the tag. That is the whole release,
F-Droid included.
Before tagging, write the release's F-Droid changelog,
fastlane/metadata/android/en-US/changelogs/<versionCode>.txt, at most 500
characters; the code is major10000 + minor100 + patch, so 0.0.5 is 5.txt.
The F-Droid lane only warns when it is missing, since the file is part of the
tag's source and a re-run could not add it; F-Droid then shows no "what's new".
The tag starts .github/workflows/android-release.yml, which publishes the
signed APK and AAB to GitHub Releases. Then android-fdroid.yml writes X.Y.Z
into version.properties on a commit over the tag, builds it the way F-Droid
will (lint, update bot, build), signs that build with the release key and adds
it to the release as skywire-X.Y.Z-fdroid.apk, and if all of that passes
tags it fdroid-vX.Y.Z. F-Droid's update bot watches fdroid-v* tags and
publishes each one by itself, using the recipe in fdroid/com.skycoin.skywire.yml.
The F-Droid build is reproducible: F-Droid builds the same commit, checks
that its build is byte-identical to skywire-X.Y.Z-fdroid.apk (the recipe's
Binaries), and ships that APK with our signature rather than its own
(AllowedAPKSigningKeys pins the certificate). GitHub and F-Droid installs
therefore carry the same signature and update each other, and the release
key is the one key behind both: keep a backup of it (and its passwords)
outside GitHub, because a lost key means no install anywhere can be updated
again.
If the F-Droid step fails, fix it on develop and run it again for the same
tag: Actions → Android F-Droid → Run workflow, or
gh workflow run android-fdroid.yml -f tag=mobile-vX.Y.Z. No new release is
needed; the tag's source is built with develop's script and recipe. A re-run
builds the existing fdroid-vX.Y.Z commit if there is one, and checks a
skywire-X.Y.Z-fdroid.apk already on the release against its build instead of
replacing it.
Part of Skywire, licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-only); a commercial license is also available — see COMMERCIAL-LICENSE.md.