Android
The Android host is a library module (:bare-host) published as a
self-contained AAR (io.github.anderscan.ekrooh:bare-host on Maven Central, with GitHub
Packages as a fallback): the Bare Kit runtime jar ships in the AAR’s libs/
and its native libs in jni/, so consumers need no separate prebuilds
download.
The version tracks the framework version (single version across the npm package
and the AAR, released together on the same tag — see RELEASING.md). Pin it to
the framework version you depend on.
Public surface
Section titled “Public surface”BareProtocol— Kotlin mirror of the binary wire protocol.HostIpcCoordinator— frames in/out of the worklet’s IPC, written through one serialized writer.HostPluginRegistry— maps host plugin IDs to handlers.BareHandoff— parseshandoff.jsonand deletes it as it reads it.BareWebViewClient— WebView wiring: logs resource errors and confines the main frame toallowedOrigin. A link the user taps to another http(s) site opens in the system browser; a navigation without a gesture (a meta refresh, a script redirect) is only cancelled; a POST navigation is answered with an empty 403.BareHostAbi—requireSupportedAbi()throws on a 32-bit-only device or in a 32-bit process (see ADR 0002).
The public API is dumped to android/api/bare-host.api; ./gradlew check
runs apiCheck, so a changed signature fails the build until the dump is
regenerated with ./gradlew :bare-host:apiDump and reviewed.
Reference app
Section titled “Reference app”examples/android-app is the shell that embeds the backend and WebView:
- The worklet runs in the
Application(BareApplication+ReferenceHost), not per Activity, so rotation and a second launch do not restart the backend.MainActivityis the only exported component, withlaunchMode="singleTop", and itsconfigChangescover rotation, UI mode, density, font scale, locale and layout direction. Only the first WebView gets the bootstrap nonce; later ones log in with the session cookie. - The host starts the worklet with
[webAssets, storage, cache], where durable storage isnoBackupFilesDir/bare(moved once from the oldcacheDir/bare), (a failed move falls back to the old directory and is retried each launch), readshandoff.jsonthroughBareHandoff.consume(a late handoff is still consumed after the error page is shown), injectswindow.__ekrooh = { bootstrap }(a one-time nonce, never the raw token; pluswindow.BareShell) withaddDocumentStartJavaScriptafter a WebView feature check, and loadshttp://127.0.0.1:<port>/index.html. - The WebView has file and content access off; cleartext is allowed only to
127.0.0.1/localhost, and every backup domain is excluded. - A real native photo picker/camera feeds
vendor.media.
Consuming
Section titled “Consuming”repositories { mavenCentral() // default in modern Gradle/Android Studio; no auth needed}
dependencies { implementation "io.github.anderscan.ekrooh:bare-host:<version>" // same version as @ekrooh/bare}Note: the groupId is your verified Maven Central namespace with the project’s sub-namespace appended (
io.github.anderscan.ekrooh— parentio.github.anderscanis the reverse of the GitHub Pages URL and auto-verifiable via your GitHub account). If you were consuming from GitHub Packages before, the maven layout is identical — just drop themaven { url = "https://maven.pkg.github.com/AndersCan/ekrooh" }repository and theread:packagesPAT wiring. No credential block is required for Maven Central.
npm run prebuilds # fetch Bare Kit prebuilds (prebuilds/)./gradlew :examples:android-app:assembleDebugThe Gradle Exec tasks that build the JS inputs assume a flat node_modules
(npm/yarn, or pnpm with nodeLinker=hoisted) and run from the repo root — see
Android Host Build before copying the
build.gradle pattern into a consumer repo.
Tests: JUnit in src/test/ (./gradlew :bare-host:testDebugUnitTest).