Chanzmao ʕ•ᴥ•ʔ Bear Blog

Comparing Modern Android Project Templates: Empty Activity vs. Kotlin Multiplatform

When I started setting up a new Jetpack Compose project, I noticed that the generated Gradle configuration had changed quite a bit from what I was used to.

The familiar build.gradle.kts files were still there, but the way plugins, dependencies, and project configuration were organized looked different.

Rather than relying on an old project as a reference, I wanted to see what today’s project templates actually generate.

I found two useful sources:

The first provides copies of the templates used by Android Studio when creating a new project. The second provides several Kotlin Multiplatform project templates maintained by JetBrains.

For this comparison, I’ll focus on four templates:

  1. Android Studio Empty Activity
  2. Kotlin Multiplatform Shared UI App
  3. Kotlin Multiplatform Native UI App
  4. Kotlin Multiplatform Library

The goal is not to decide which template is universally better. Instead, I want to understand how their Gradle configurations differ and what we can learn from their structure.

Empty Activity Is the Starting Point for Modern Compose Projects

Let’s start with Android Studio’s Empty Activity.

For a new Android application using Jetpack Compose, this is the natural starting point.

It provides a basic Android application with the necessary Compose configuration, allowing us to focus on building the UI rather than setting up everything from scratch.

One useful resource is Sebastian Carlos’s repository:

sebastiancarlos/android-studio-new-project-original-templates

It contains copies of the original Android Studio templates, making it possible to inspect the generated project without repeatedly creating projects in the IDE.

The repository includes several templates, such as:

For this article, we’ll use EmptyActivity.

This gives us a baseline for a conventional Android application.

Reference: Create a project – Android Developers

Kotlin Multiplatform Wizard Provides Three Other Project Structures

Next, let’s look at JetBrains’ Kotlin Multiplatform Wizard.

Kotlin Multiplatform Wizard – Templates

The template gallery provides several project configurations. We’ll focus on three Gradle-based templates.

A: Shared UI Multiplatform App

This template shares both UI and business logic between Android and iOS using Compose Multiplatform.

The project has separate platform-specific application modules and a shared module.

A typical project structure looks like this:

project/
├── androidApp/
├── iosApp/
├── shared/
├── gradle/
│   └── libs.versions.toml
├── build.gradle.kts
└── settings.gradle.kts

The important point is that the shared module contains code that can be reused across platforms.

Android and iOS are not simply two targets inside one Android application module. They have different entry points and platform-specific configurations.

B: Native UI Multiplatform App

This template shares business logic while keeping the UI native to each platform.

Its project structure is similar to the Shared UI template, but the UI implementation is separated.

project/
├── androidApp/
├── iosApp/
├── shared/
├── gradle/
│   └── libs.versions.toml
├── build.gradle.kts
└── settings.gradle.kts

The key difference is the separation between shared business logic and platform-specific UI.

This is useful when we want to reuse domain and data-layer code without forcing both platforms to use the same UI framework.

C: Multiplatform Library

Unlike the previous two templates, this one is designed to create a Kotlin Multiplatform library rather than an application.

Its purpose is to provide reusable functionality that can be distributed across multiple platforms.

A typical project structure looks like this:

project/
├── library/
├── gradle/
│   └── libs.versions.toml
├── build.gradle.kts
└── settings.gradle.kts

There is no Android application module to launch.

Instead, the library module defines the supported targets and produces reusable library artifacts.

The Four Gradle Files We Want to Compare

Now let’s focus on the four files that define the project’s Gradle configuration.

File Responsibility
settings.gradle.kts Project structure and module inclusion
root: build.gradle.kts Project-level plugin declarations
module: build.gradle.kts Module-specific plugins, Android configuration, and dependencies
gradle/libs.versions.toml Centralized dependency and plugin versions

These files are not interchangeable. Each has a different responsibility.

1. settings.gradle.kts

This file defines the Gradle project structure.

For a simple Android application, the configuration is relatively small.

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "MyApplication"

include(":app")

The important part is:

include(":app")

This tells Gradle that the project contains an app module.

In a Kotlin Multiplatform project, however, we need to include multiple modules.

For example:

include(":androidApp")
include(":shared")

The exact modules depend on the selected template.

This is the first major difference between a standalone Android application and a multiplatform project.

2. root: build.gradle.kts

The root-level build script declares plugins that can be used by the project’s modules.

A typical version-catalog-based configuration looks like this:

plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.compose) apply false
}

Notice the use of apply false.

The root project declares the plugin versions without applying those plugins to the root project itself.

Individual modules can then apply the plugins they actually need.

Kotlin Multiplatform projects require additional plugins, such as the Kotlin Multiplatform plugin and Compose Multiplatform plugin, depending on the selected template.

The important distinction is that plugin declarations are centralized, while plugin application happens at the appropriate module level.

3. module: build.gradle.kts

This is where most of the actual module configuration happens.

For an Android application, we typically find:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.compose)
}

android {
    namespace = "com.example.app"

    compileSdk = 36

    defaultConfig {
        applicationId = "com.example.app"
        minSdk = 28
        targetSdk = 36
    }

    buildFeatures {
        compose = true
    }
}

The exact plugin configuration and Android DSL depend on the Android Gradle Plugin and Kotlin versions used by the generated template.

In a KMP project, the configuration becomes more involved.

The shared module needs to define its supported targets and source sets. The Android application module, meanwhile, remains responsible for Android-specific application configuration.

For example, a KMP module may use:

kotlin {
    androidTarget()
    iosArm64()
    iosSimulatorArm64()

    sourceSets {
        commonMain.dependencies {
            // Shared dependencies
        }
    }
}

This illustrates an important architectural difference.

An Android application configures an Android application module. A Kotlin Multiplatform project configures multiple compilation targets and their shared source sets.

4. gradle/libs.versions.toml

The version catalog is another important part of modern Gradle projects.

Instead of scattering dependency versions throughout multiple build scripts, we can centralize them.

For example:

[versions]
agp = "9.5.1"
kotlin = "2.3.20"

[libraries]
androidx-compose-bom = {
    module = "androidx.compose:compose-bom",
    version.ref = "composeBom"
}

[plugins]
android-application = {
    id = "com.android.application",
    version.ref = "agp"
}

kotlin-compose = {
    id = "org.jetbrains.kotlin.plugin.compose",
    version.ref = "kotlin"
}

We can then reference these entries from build.gradle.kts:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.compose)
}

The main advantage is consistency.

When multiple modules use the same plugin or dependency, we don’t need to repeat version declarations.

Kotlin Multiplatform templates also use version catalogs, but their catalogs contain additional plugins and libraries for multiplatform development.

For example, they may define plugins for Kotlin Multiplatform, Compose Multiplatform, serialization, and platform-specific tooling.

What Actually Changes Between the Four Templates?

Let’s summarize the differences.

Configuration Empty Activity Shared UI Native UI KMP Library
Project type Android app Multiplatform app Multiplatform app Multiplatform library
Android module app androidApp androidApp Depends on targets
Shared module No Yes Yes Yes
Shared UI No Compose Multiplatform No No
Android UI Jetpack Compose Compose Multiplatform Jetpack Compose Not applicable
iOS UI No Compose Multiplatform SwiftUI Not applicable
Version catalog Yes Yes Yes Yes
Main purpose Android development Shared UI and logic Shared logic, native UI Reusable library

The most important difference is not the syntax of Gradle itself.

It is the project architecture that Gradle describes.

Empty Activity is relatively straightforward because it only needs to configure one Android application module.

Kotlin Multiplatform projects need to describe platform targets, shared source sets, and multiple modules.

That additional complexity is reflected in the generated Gradle files.

Which Template Should We Start With?

For a conventional Android application built with Jetpack Compose, Empty Activity is the natural choice.

There is no particular advantage in starting with a Kotlin Multiplatform template if we have no intention of sharing code with other platforms.

On the other hand:

The template should reflect the architecture we actually intend to build.

Conclusion

When creating a new Android project, it is tempting to copy the Gradle configuration from an existing project.

However, modern Android and Kotlin Multiplatform templates have different project structures and responsibilities.

Comparing their generated files makes those differences much easier to understand.

For a new Jetpack Compose application, I’ll continue to use Empty Activity as my starting point.

It provides a clean Android foundation without introducing unnecessary multiplatform configuration.

More importantly, understanding the four Gradle files gives us a much better starting point for customizing the project as it grows.

References

Mentioned in

#Android #Jetpack Compose #Kotlin