# Create a native Android app

Scaffold a Kotlin and Jetpack Compose application, then build it with Gradle and Nx.


Use the `android` preset for a native Kotlin/Jetpack Compose application. Choose `mobile` instead when you want Expo and React Native for both iOS and Android.

## Preview and create

From an existing Nx workspace with Megamono installed:

```sh
megamono add app android --dry-run
megamono add app android --yes
```

The default directory is `apps/android`. To choose a name and Android identity instead:

```sh
megamono add app android --name=reader --displayName="Reader" --applicationId=com.example.reader --dry-run
```

Review the plan, then replace `--dry-run` with `--yes`. This creates `apps/reader`; use `--directory=apps/native-reader` for a different root. Choose an application ID you control before distribution. The display name is user-facing; it is not the package identity.

The preset belongs to `@megamono/plugin:app`, not a separate Android inference plugin. It creates a new application; it does not adopt or overwrite an existing Android project.

In `create-megamono`, select Android in the application picker. Multiple Android apps can have separate names, for example `--apps=android:reader,android:admin`. The workspace-creation CLI currently supports macOS and Linux; the generated Gradle project also includes Windows wrappers.

## Prepare the native toolchain

Generation does not require an Android SDK. Building this scaffold requires JDK 17, Android SDK platform 36, and build tools 35.0.0. Configure `JAVA_HOME` and `ANDROID_HOME`, or use Android Studio to configure the SDK. Review and accept SDK licenses yourself.

The generated README records the pinned Gradle, Android Gradle Plugin, and Kotlin versions. Keep its checksum-pinned wrapper with the application; do not substitute a globally installed Gradle version.

## Inspect and run the targets

```sh
npm exec -- nx show projects
npm exec -- nx show project <project>
npm exec -- nx run <project>:build
npm exec -- nx run <project>:test
npm exec -- nx run <project>:lint
```

Replace `<project>` with the generated name shown by Nx, and use your workspace's package manager. `build` assembles a debug APK, `test` runs JVM tests, and `lint` runs Android Lint. These are not device or UI tests.

Start an emulator or connect an authorized device yourself before running `npm exec -- nx run <project>:install`. This installs the debug APK; it does not start an emulator or launch the app.

## Keep release work explicit

The manifest requests no permissions by default. Add only those your product requires. Signing keys, release signing, store submission, and device qualification remain application-owned.

Generated native Nx targets are non-cacheable and serialize execution within the project. Qualify compiler, SDK, environment, and signing inputs before changing that policy. A successful scaffold or debug build is not release qualification.

Next, review [repository structure](/docs/workflows/repository-structure) and [application options](/docs/generators/app).
