Skip to main content
Klyx extensions are built using the Klyx Gradle plugin, which packages your APK and generated manifest into a .klyx bundle (a gzipped tarball).

The Klyx Gradle plugin

Apply the plugin in your app/build.gradle.kts:
The Klyx Gradle plugin (io.github.klyx-dev.compiler.plugin) does several things:
  • Applies the Kotlin compiler plugin that processes @PluginManifest
  • Auto-detects icon.png, readme.md, and changelog.md from the project root
  • Applies the Android Application or Library plugin automatically
  • Enables Jetpack Compose if the compose option is set (enabled by default)
  • Adds klyx-api as a compileOnly dependency automatically
  • Sets minSdk to 28, Java 21 compatibility, and buildFeatures.compose = true
You do not need to apply com.android.application, kotlin.compose, or kotlin.serialization yourself — the klyx plugin handles all of that.

Configuration options

All options are available on the klyx { } extension block:

Auto-detected files

The plugin automatically detects and includes these files from the project root if you do not specify them explicitly:

Build tasks

The plugin adds several Gradle tasks: The push tasks run automatically after bundling when autoPushToDevice is true:
This produces output/MyExtension.klyx.

Bundle format

The task produces a .klyx file — a gzipped tarball containing:

Android Studio IDE support

For the best plugin development experience, enable the klyx compiler plugin in Android Studio so you get IDE features like code completion and navigation for Klyx APIs. Go to Menu > Help > Edit Custom Properties… and add this line to the idea.properties file:
Restart Android Studio after making this change.

R8 / ProGuard

If you enable minification, keep your entry class:
The @PluginManifest annotation ensures the entry class name is generated into plugin.json. However, if R8 renames or removes the class, Klyx will not be able to load it reflectively. Make sure to add a keep rule.

AndroidManifest

Keep it minimal:
No activities, services, or providers are needed. The plugin entry point is declared via the @PluginManifest annotation, not the manifest.

Version compatibility

The minAppVersion in your @PluginManifest annotation should match the version of klyx-api you are compiling against. For example, if your build.gradle.kts uses a version catalog:
then set minAppVersion = "4.2.0" in the @PluginManifest.

Publishing to the registry

Klyx hosts a community plugin registry at github.com/klyx-dev/plugins. Publishing is done through a pull request — CI validates your bundle and publishes it automatically on merge.

Prerequisites

  1. Your @PluginManifest annotation is valid (see manifest reference for validation rules)
  2. You have built a .klyx bundle with ./gradlew klyxBundle

Publish via pull request

  1. Fork the registry repo
  2. Add your .klyx file to the incoming/ directory
  3. Create a pull request to main
  4. Wait for CI — the workflow validates your bundle and posts results as a PR comment
  5. Merge once validation passes — your plugin is published automatically

What CI validates

The registry CI pipeline checks:
  • plugin.json exists and is valid JSON
  • All required fields are present and non-empty: id, version, name, minAppVersion, entryClass
  • id matches the format: reverse-DNS (e.g. com.example.myplugin)
  • version follows semver (e.g. 1.0.0)
  • minAppVersion and maxAppVersion follow semver
  • entryClass is a valid fully-qualified class name
  • author.name is present if author is an object
  • plugin.apk exists in the bundle

After publishing

The publish workflow:
  1. Creates a directory under plugins/{plugin-id}/ with all versioned bundles and extracted metadata
  2. Updates plugins/index.json — the auto-generated registry index
  3. Purges the jsDelivr CDN cache so users see the latest version
  4. Clears the incoming/ directory

Ownership

When you first publish a plugin, you become its owner. The registry tracks ownership through a Cloudflare Worker at plugins.klyx.workers.dev. Only the registered owner can publish updates to that plugin ID. This prevents namespace squatting and unauthorized updates.

Manual distribution

You can also share .klyx files directly with users. They can open the file with Klyx to install the extension.