Skip to main content
This guide walks you through creating a minimal Klyx extension from scratch. You will set up a project, implement the plugin using @PluginManifest, and bundle it into a .klyx file.

Prerequisites

  • Android Studio (latest stable)
  • A Klyx-compatible device or emulator running Klyx 4.2.0 or later
  • Basic knowledge of Kotlin and Jetpack Compose
  • Kotlin 2.1 or later (for context receivers support)

1. Create the project

Create a new Android project in Android Studio with No Activity. Use minimum SDK 28 and Kotlin. Your project structure should look like this:
Note that there is no plugin.json file — the @PluginManifest annotation generates it for you at compile time.

2. Configure the version catalog

In gradle/libs.versions.toml:
The klyx plugin provides Kotlin, AGP, and Compose automatically — you do not need to add them yourself.

3. Set up the root build file

In build.gradle.kts:

4. Configure the app module

In app/build.gradle.kts:

5. Write the Android manifest

In app/src/main/AndroidManifest.xml:
No activities, services, or providers are needed. The plugin entry point is declared via the @PluginManifest annotation, not the manifest.

6. Implement the plugin

In app/src/main/java/com/yourext/MyExtension.kt:
Notice how screens.register(...) does not require passing this. Registration methods use Kotlin context receivers — the compiler infers the plugin from the surrounding KlyxPlugin context.

7. Build the bundle

Run the Gradle task:
This produces output/MyExtension.klyx — a gzipped tarball containing your APK and the generated plugin.json.

8. Install on Klyx

Transfer the .klyx file to your device and open it with Klyx. Klyx extracts the bundle, reads plugin.json, loads the APK, instantiates your entryClass, and calls onLoad() followed by onStart().

Next steps

Plugin Manifest Reference

Full reference for the @PluginManifest annotation

Plugin Lifecycle

Understand load, start, stop, and unload

Building & Bundling

Package and publish your extension