Skip to content

Install

Lustro has six pairs of artifacts: lustro, which has the server and the Network tab, and one pair for each plugin. Each pair has two halves with the same public API, and you add each half to one build type. This page adds the lustro pair:

  • io.github.twinsen81:lustro is the debug runtime: the embedded server, the capture, and the console.
  • io.github.twinsen81:lustro-noop is the no-op half for release builds. It has the same public classes with empty bodies, so your integration code compiles and runs in a release build with no server, no capture, and no open socket.

The two halves declare the same Gradle capability (io.github.twinsen81:lustro-runtime), so Gradle cannot put both on one configuration. Add each half to its own build type, with debugImplementation and releaseImplementation:

# gradle/libs.versions.toml
[versions]
lustro = "0.1.0"

[libraries]
lustro      = { group = "io.github.twinsen81", name = "lustro",      version.ref = "lustro" }
lustro-noop = { group = "io.github.twinsen81", name = "lustro-noop", version.ref = "lustro" }
// build.gradle.kts (app module)
dependencies {
    debugImplementation(libs.lustro)
    releaseImplementation(libs.lustro.noop)
}

An app whose code in src/main names no Lustro type can leave out the no-op halves, with their releaseImplementation lines, and keep every Lustro call in src/debug. Its release build then has no Lustro class: see Without the no-op halves.

The releases are on Maven Central, so mavenCentral() in the repositories of settings.gradle.kts is enough.

Each merge to main also publishes a -SNAPSHOT of the next version to the Sonatype Central snapshots repository. To try a change before its release, add that repository and use the -SNAPSHOT version that VERSION_NAME in gradle.properties names:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven("https://central.sonatype.com/repository/maven-snapshots/")
    }
}

Lustro declares the INTERNET permission in its manifest.

Each plugin is a pair of its own, which you add in the same way: see the Install section of Logs, Preferences, SQLite, WorkManager, and Screen. Modules lists every artifact.

Keep all Lustro artifacts on one version, as the one lustro version above does. The plugins call an API of lustro-api that can change from one version to the next, so the artifacts work only together with the same version. Each artifact asks Gradle for its own version of every other Lustro artifact, so Gradle takes the highest version that one of them asks for, for all of them: when an update moves lustro to a new version and leaves lustro-logs on an older one, the build gets the new version of both.

Keep the process lifecycle initializer

The server binds when ProcessLifecycleOwner reports that the app is in the foreground. androidx.startup's InitializationProvider initializes that lifecycle through ProcessLifecycleInitializer before Application.onCreate(), and lifecycle-process adds both to the merged manifest. An app that removes the provider, or that meta-data entry, with tools:node="remove" leaves the lifecycle not initialized: start() returns ENABLED, but the server never binds. start() then logs a WARN at the Lustro tag that names the entry. Lustro can't initialize the lifecycle itself, because ProcessLifecycleInitializer refuses to start after the app's startup.

To turn off another initializer, remove only its own meta-data entry and keep the provider, as for WorkManager's:

<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    android:exported="false"
    tools:node="merge">
    <meta-data
        android:name="androidx.work.WorkManagerInitializer"
        android:value="androidx.startup"
        tools:node="remove" />
</provider>

Minimum versions

Adding Lustro does not raise the versions of your app's own dependencies. Each published artifact declares the oldest version of a dependency that has the APIs it uses, and Gradle keeps your newer one.

Minimum Notes
Android Gradle Plugin 8.6 The oldest that supports compileSdk 35.
compileSdk 35
minSdk 24 21 for the no-op halves, which call no Android API. An app with a lower minSdk raises it for its debug variant only: see below.
Kotlin 2.0 The artifacts carry Kotlin 2.0 metadata and need kotlin-stdlib 2.0.21 or newer.
OkHttp 4.12.0 4.x or 5.x. CI runs Lustro's tests against OkHttp 5 as well.
androidx.lifecycle 2.4.1 lifecycle-process only, and only in lustro.
kotlinx.coroutines none Lustro has no coroutines dependency. lustro-prefs calls the app's own coroutines only for a registered DataStore.
androidx.datastore none compileOnly in lustro-prefs and lustro-prefs-noop. A registered PrefsDataStore needs DataStore 1.0, and a bytes value 1.1.
androidx.sqlite none compileOnly in lustro-sqlite and lustro-sqlite-noop. A registered SqliteDb.support needs androidx.sqlite 2.0, which Room brings.
androidx.work none compileOnly in lustro-work and lustro-work-noop. The WorkManager tab needs work-runtime 2.12.0, and its history work-analytics 2.12.0.
androidx.compose.ui none compileOnly in lustro-screen. The Screen tab reads the Compose semantics tree with Compose UI 1.6.0 or newer, and the View tree in any app.

The runtime needs API 24, for logcat --pid among others. An app whose minSdk is lower keeps it for its release build, which takes the no-op halves, and raises it for the debug variant, which takes the runtime. WorkManager 2.12.0, which the WorkManager tab needs, needs API 24 itself: with an older WorkManager, the tab answers work_unsupported.

// build.gradle.kts (app module)
androidComponents {
    beforeVariants(selector().withBuildType("debug")) { variant ->
        variant.minSdk = 24
    }
}
// build.gradle (app module), the same in Groovy
androidComponents {
    beforeVariants(selector().withBuildType("debug")) { variant ->
        variant.minSdk = 24
    }
}

lustro also brings NanoHTTPD 2.3.1, its embedded server. CI builds a small app in consumer-check/ with exactly these versions, and again on a current toolchain, and fails when a published artifact would change any version the app has. CI also builds it with minSdk 23, with its debug variant raised as above, and it registers every tab from Java too.

The lustro CLI

The lustro command opens the console with its token, and drives every tab from a terminal, a script, or a coding agent: see Agents and automation. It is a Python package, lustro-cli, that needs Python 3.9 or newer and no other package.

Each release publishes the CLI to PyPI as lustro-cli, with the library's version:

uv tool install lustro-cli    # or: pipx install lustro-cli
lustro open                   # forwards the port, and opens the console with the token
uvx lustro-cli net list       # runs the CLI without an install

To get the CLI of main before a release, install it from GitHub with uv tool install "git+https://github.com/Twinsen81/Lustro#subdirectory=lustro-cli", which pipx also takes. From a checkout of this repository, uv tool install ./lustro-cli installs the CLI of that checkout.

The PyPI package lustro is a different project that also installs a lustro command, so do not install it, and do not run uvx lustro.