From August 31, 2026, Google Play requires new apps and updates to target Android 16 (API level 36), according to Google’s 2026 target API level requirements. That date shapes every new project, so it’s worth knowing before you touch a single setting.
The rest of the stack is less dramatic. Code gets written and run in Android Studio, and the screens are built with Jetpack Compose. State and background work live in a ViewModel with coroutines. The finished app ships to Google Play as a signed Android App Bundle.
Google’s UI documentation points to a Compose-first Android and recommends migrating View-based UIs to Compose, so new Android app development with Kotlin starts there.
How to Set Up Android Studio, the Android SDK and an Emulator

Install Android Studio and let the setup wizard download the SDK components. After that you either create a virtual device or plug in a real phone, and a first Kotlin build has everything it needs.
Google’s download page currently lists Android Studio Rabbit 2 (2026.2.2 Patch 1) as the release to get. Panda, Quail and Rabbit builds all hit the stable channel in 2026, which is why menu paths in older tutorials often don’t match your screen.
Google’s own first-app codelab asks for basic Kotlin knowledge and the latest Android Studio, and that’s it.
- Download the build for your system from the official page. Windows gets an .exe or .zip, and Macs get separate .dmg files for Apple silicon and Intel.
- Run the installer and the setup wizard so the Android SDK components download.
- Open Device Manager and create an Android Virtual Device with a recent system image.
- Or use a phone instead. Open Settings, tap Build number under About phone until developer options appear, then turn on USB debugging.
- Run
adb devicesfrom the platform-tools folder and confirm the device shows up in the list.
Manufacturers move these menus around, so the exact path differs from phone to phone. If yours hides it, this guide to developer options on Android is worth a look.
Connection setup differs by platform.
- On Windows, install an OEM USB driver for ADB where one applies.
- Ubuntu needs your user added to the plugdev group and the udev rules package installed, then a log out and back in.
- macOS and ChromeOS need no extra setup.
- Wi-Fi debugging needs Android 11 or higher and a one-time pairing code or QR code. The phone also has to be on the same wireless network as the workstation.
The first USB connection triggers an RSA key dialog on the phone, and adb stays blocked until you unlock the device and accept it.
Google’s SDK guidance says to test on an emulator built for your minimum API level first, then on higher levels. A real phone is the better judge of current behavior and true performance, but it can’t help with old Android versions you don’t own. That’s the emulator’s job.
How to Create and Run Your First Kotlin Project

Pick the Empty Activity template, name the app, set a minimum SDK and press Run. The template builds a single-screen Compose app that displays “Hello Android!”
Templates just generate the project structure and the files Android Studio needs to build the app. The Preview pane shows the greeting after a Build and Refresh, so you see the screen before any emulator boots.
The onCreate function is the entry point of the app, and it calls other functions to build the user interface.
What the Generated Files Do
MainActivity.ktis the launcher activity and the home of the onCreate entry point.AndroidManifest.xmltells the system which activities and permissions the app declares.- In
app/build.gradle.ktsyou’ll find the namespace and dependencies, along with the compileSdk, minSdk and targetSdk values. gradle/libs.versions.tomlis the version catalog that recent templates generate for library versions.res/covers strings, colors, themes and launcher icons.
The application ID in the Gradle file becomes the app’s permanent identity on Google Play. Choose it before the first upload.
Choosing minSdk, compileSdk and targetSdk
| Setting | Where it lives | What it controls |
|---|---|---|
| minSdk | Gradle defaultConfig | Lowest API level that can install the app |
| compileSdk | Gradle android block | Framework APIs your code compiles against |
| targetSdk | Gradle defaultConfig | The API level you tested against |
Set minSdk too low and the app installs on old devices, then crashes the moment it calls an API that doesn’t exist there. Too high, and you simply lose devices.
When a device runs a higher API level than your targetSdk, the system applies compatibility behaviors so the app keeps working the way it did. Google recommends raising the value to the latest API level and testing on that platform.
For phones and tablets, the choice is already made. New apps and updates must target Android 16 (API level 36) or higher on Google Play from August 31, 2026.
Skip maxSdkVersion entirely. Google advises against declaring it, because on some devices it can get the app removed after a system update.
Jetpack Compose or XML Views: Which Should a New App Use?
A new app should start with Jetpack Compose, which is also where Google’s own documentation is heading. It recommends migrating View-based UIs to Compose.
Google measured the cost on its Sunflower sample app. The build time column below is as published, in milliseconds.
| Approach | Mean debug build (ms) | Minified release download (KB) | Fits |
|---|---|---|---|
| Views only | 299.47 | 2,252 | Existing View apps |
| Mixed Views and Compose | 399.09 | 3,034 | Migration in progress |
| Compose only | 342.16 | 2,966 | New apps |
The source is the Android Developers documentation (Sunflower sample, gradle-profiler for builds, R8 full mode with APK Analyzer for size). Google states that the results are specific to Sunflower. They depend on module count and dependencies, and they change again as library versions change.
So Compose costs build time and download size up front, though a Compose-only app wins some of that back. Google credits the build-time recovery to removing data binding and updating dependencies, along with the move from kapt to KSP. The smaller download comes from dropping View dependencies the app no longer uses, such as AppCompat and ConstraintLayout.
The payoff is less UI code. Google’s Play Store team found that writing UI took much less code, sometimes up to 50% less.
Compose layouts are Kotlin compiled with the app, so there is no XML inflation cost on first display. Each layout composable gets one layout pass, which helps with deep UI trees. Previews render in Android Studio without an emulator, and honestly that’s the part I’d miss most if I went back.
The downsides are real, though. APKs get larger and builds slower than in a Views-only app. Compose is also unbundled, so it misses Zygote preloading and depends on profile installation in release builds. Debug builds perform very differently from release builds, which means you should profile in release.
XML views still work fine for what they already do. Existing View UIs stay maintainable with their current workflows, but nested ViewGroups can need multiple layout passes, and Google still recommends moving off them.
Mixing is possible too, since you can use Compose inside Views and Views inside Compose. No screen needs a rewrite on day one. The cost is the heaviest build and download size of the three, per the table above.
The decision rule is short. A new app goes Compose-only. An existing View app adds Compose to new screens and moves old ones over gradually, and Google documents interoperability with Espresso and UiAutomator, so the existing test suite is not a blocker.
How to Build Screens with Composables, State and Navigation
A Compose screen is a tree of @Composable functions that read state and report user events upward.
Composable Functions and Previews
The @Composable annotation tells the Kotlin compiler that the function generates UI for Jetpack Compose. Keep them small, and give each one a preview.
Adding @Preview tells Android Studio to show the composable in the Design view. @PreviewParameter supplies sample data, one preview per value, and edits show up live in the preview.
The preview system can’t construct a ViewModel, which trips people up. A composable that needs one should take plain parameters with sample defaults instead.
Material 3 theming
Material 3 theming is built from a color scheme and typography, plus shapes. You pass them to MaterialTheme so components pick them up. The dependency is the androidx.compose.material3 artifact.
Dynamic color derives a palette from the user’s wallpaper and works on Android 12 and higher, so older versions need a fallback scheme. Pair each container color with its matching on-color to keep contrast readable.
State and Recomposition
The classic first bug is a text field that ignores typing. The field’s value is hard-coded and onValueChange throws the input away, so nothing ever changes.
remember stores an object in the Composition and returns it on recomposition, then forgets it when the composable leaves the Composition. Changing the value of a mutableStateOf schedules recomposition of every composable that reads it.
rememberSaveable goes a step further and survives configuration changes such as rotation, which plain remember does not. It still won’t survive the user swiping the activity away from Recents.
Plain mutable lists never notify Compose, so the screen shows stale data. Hold an immutable list inside a State object instead.
Where state lives matters as much as how. Google’s rule is to hoist state to the lowest common ancestor of the composables that read and write it. State flows down as read-only parameters and events flow back up as lambdas. Don’t pass ViewModel instances to child composables.
Navigation Between Screens
An all-Compose app uses Navigation Compose, where the destinations in the graph are composables. A mixed app keeps the Fragment-based component and moves its graph to Navigation Compose once every fragment is gone.
A NavHost swaps destinations in and out, while the NavController coordinates navigation, deep links and the back stack. Each destination is identified by a route, which can be any serializable type.
Type-safe routes need the Kotlin serialization plugin and kotlinx-serialization-json, plus the navigation-compose artifact itself. The sample on Google’s page pins navigation-compose 2.10.2, so check the release page for the current version before copying it.
Back and up actions work by default, and predictive back on Android 13 and higher works with the component. Pass lambdas into screens, not the NavController, which is the same events-up rule from the state section.
How to Structure the App with ViewModel, Coroutines and Flow
Put UI state in a ViewModel, run asynchronous work in coroutines launched from viewModelScope, and expose results as a StateFlow that the screen collects.
ViewModel and UI State
The ViewModel is the screen-level state holder, and it keeps state through configuration changes, so rotating the screen does not refetch data.
Google recommends at least two layers, a UI layer and a data layer, plus an optional domain layer used only when needed. State flows one way, from data sources to the UI, and user events flow back the other way.
A ViewModel stays in memory until its owner goes away, meaning the activity finishes or the navigation entry leaves the back stack. It must not hold Context or Resources, since that causes memory leaks. If data has to survive process death, SavedStateHandle persists it.
Coroutines and Flow
A blocking network call on the main thread stops the OS from drawing, which freezes the app and can trigger an Application Not Responding dialog. Coroutines fix that.
A coroutine launched from viewModelScope with no dispatcher runs on the main thread, and that catches beginners out. And when the ViewModel is destroyed, viewModelScope cancels every coroutine running in it.
The clean pattern keeps the repository main-safe. It wraps its blocking work in withContext(Dispatchers.IO), so callers never manage threads. Injecting the dispatcher into the repository also makes it easier to test.
When the login function runs, the order goes like this.
- login() is called on the main thread.
- launch starts a coroutine on the main thread.
- The repository call suspends while the withContext block runs on an I/O thread.
- The coroutine resumes on the main thread with the result.
A flow emits many values in sequence, unlike a suspend function that returns one. Flows are cold, and the terminal collect call starts them from inside a coroutine.
In Compose, the screen-level composable reads the ViewModel’s StateFlow with collectAsStateWithLifecycle(). Google’s ViewModel example collects uiState exactly this way.
Repository and Dependency Injection
The data layer is made of repositories, and each repository holds zero or more data sources. The ViewModel talks to the repository and nothing below it.
A first app with two screens does not need Hilt. I’d pass the repository into the ViewModel by hand until the object graph starts to hurt.
Hilt is built on Dagger, and Google’s docs call it the officially recommended dependency injection library for Android. It cuts boilerplate and ties component lifecycles to Android classes.
Wiring it up takes the Hilt Gradle plugin, the KSP plugin and a ksp compiler dependency. Then @HiltAndroidApp goes on the Application class and @AndroidEntryPoint on the root ComponentActivity. ViewModels get @HiltViewModel with constructor injection, and the screen calls hiltViewModel().
Hilt requires Java 17, and the same page has a gotcha in its snippets. The Kotlin and Groovy versions name different compiler artifacts (hilt-android-compiler versus hilt-compiler), so check the current Dagger documentation before copying either.
How to Store and Fetch Data with Room, DataStore and Retrofit
Structured records go in Room, and small settings go in Jetpack DataStore. Retrofit is what fetches data from a REST API. Which one you reach for depends on the shape of the data, and all of them sit behind the repository.
| Tool | Handles | Wrong choice when |
|---|---|---|
| Room | Relational records queried through DAOs | You only store a few flags |
| Jetpack DataStore | Key-value pairs or typed objects | Data is large or complex, needs partial updates, or needs referential integrity |
| Retrofit | Remote data over HTTP | You need the data to survive the call |
A Room setup starts with a database class that serves as the main access point to the persisted data. Entities represent the tables, and DAOs hold the functions that query, insert, update and delete.
Keep the database a singleton in a single-process app, because each RoomDatabase instance is fairly expensive. DAOs can return a Flow for live updates.
Google’s current Room page states that Room 3.0 requires KSP, and it shows the androidx.room3 artifacts at version 3.0.3. Older tutorials still use the androidx.room coordinates with a 2.x version, so a copied dependency line can point at the wrong library.
On build speed, Google’s kapt to KSP migration guide says KSP is up to 2x faster, with no benchmark conditions given. The biggest gain arrives only after the last kapt processor leaves a module.
Jetpack DataStore stores key-value pairs or typed objects, using coroutines and Flow to do it asynchronously and transactionally. Preferences DataStore takes key-value pairs with no schema and no type safety, while Proto DataStore works with typed objects defined in a .proto file.
Keep to one instance per file, because a second instance in the same process throws an IllegalStateException on read or update. A corrupted file throws CorruptionException unless you supply a ReplaceFileCorruptionHandler.
Keep DataStore access in the data layer. Expose it through a ViewModel as a StateFlow and collect it with collectAsStateWithLifecycle(), never from a composable directly.
Retrofit turns an HTTP API into a Kotlin or Java interface and generates the implementation. Each method carries an annotation such as @GET, and @Path fills placeholders in the URL.
You build a Retrofit instance with a base URL, then call create() with your interface. It runs on OkHttp underneath, and a JSON converter library handles the request and response bodies.
Network calls fail, so wrap the repository call in try-catch and surface the failure to the UI as an error result.
Then persist what the network returns. In an offline-first app the single source of truth is typically a database, so the screen reads Room and Retrofit only refreshes it.
How to Test and Debug a Kotlin Android App
Logic gets small local tests, and anything that needs a device gets instrumented tests. When something misbehaves at runtime, Logcat and Layout Inspector are where you look.
Local tests run on your development machine. They’re usually small and fast, with the subject isolated from the rest of the app, and a ViewModel unit test is the standard example. Instrumented tests run on a physical or emulated device, where the app is installed alongside a test app that injects commands and reads state. Most of them are UI tests.
Location and size are separate questions. Some local tests are big (Robolectric), and some instrumented tests are small.
For the ViewModel, hand it a fake data repository, call the function under test and assert on the data it exposes. That is the payoff of constructor injection.
Testing Compose screens
Add androidTestImplementation for ui-test-junit4, and debugImplementation for ui-test-manifest. createComposeRule() needs the manifest artifact and createAndroidComposeRule does not.
The test itself follows a fixed pattern.
- Set the content with setContent.
- Find a node, for example with onNodeWithText.
- Perform an action such as performClick.
- Assert on the result, for example with assertIsDisplayed.
Tests wait for the UI to be idle before acting, and they can mix Compose and View-based elements in the same app. Espresso targets View-based UIs, though Google says its knowledge still helps in places.
Logcat and Layout Inspector
Logcat takes key-value filters. The keys are tag, package, process, message, level and age, and package:mine limits output to the open project.
level:ERRORmatches ERROR and ASSERT, because level matches the given severity and higher.is:crashfinds native or Java app crashes.is:stacktracematches Java stack traces at any log level.
The age filter compares timestamps against the host machine, so a wrong device clock breaks it.
Layout Inspector connects to the debuggable process running in the foreground of the connected device. It shows how often a composable is recomposed or skipped, which exposes both runaway recomposition and updates that never happen.
Use the default embedded mode, which Google recommends for performance. The inspector sometimes needs an activity restart before it shows attributes.
For startup and scroll numbers on your own app, Google points to Jetpack Macrobenchmark.
What Breaks Most Often When Building Android Apps with Kotlin?
Version mismatches break more builds than code does. The Android Gradle Plugin (AGP), Gradle, the JDK, Kotlin and the Compose compiler plugin each have their own minimums, and a new Compose release can raise them.
As of Google’s AGP 9.5.0 page (October 2026, updated November 5), the floors look like this:
| Component | Minimum | Default |
|---|---|---|
| Gradle | 9.6.0 | 9.6.0 |
| SDK Build Tools | 36.0.0 | 36.0.0 |
| JDK | 17 | 17 |
Source: Android Developers, AGP 9.5.0 release page. The page lists AGP 9.6 as a preview, so 9.5.x is the current line.
The Compose compiler plugin (org.jetbrains.kotlin.plugin.compose) exists only from Kotlin 2.0, and its version has to match your Kotlin version. Pointing it at the same version.ref as Kotlin keeps them in sync.
Projects that still carry a composeOptions block with kotlinCompilerExtensionVersion need that block removed. buildFeatures { compose = true } stays required.
Compose can also force a compileSdk bump. From Compose 1.12.0, projects must use compileSdk 37 and AGP 9. That is a compile-time setting, separate from the targetSdk of 36 that Google Play requires.
Syntax has drifted too. Google’s current build overview writes compileSdk, minSdk and targetSdk as version blocks (version = release(36)), while older tutorials assign plain properties. Check which form your AGP version expects before copying either.
For sync and dependency errors, read the first error in the Build output, not the last, because the rest are usually fallout. Google keeps separate guides for debugging dependency resolution errors and for the Build Analyzer.
Then there’s the 16 KB page size. Apps targeting Android 15 (API level 35) and higher must support 16 KB page sizes on 64-bit devices, and from February 1, 2027 updates without that support cannot be released.
- Only native code is affected, meaning C or C++, NDK libraries, or third-party SDKs that ship them. Kotlin-only apps already support it.
- In Android Studio, run Build, Analyze APK, look for .so files in the lib folder, then read the Alignment column.
- AGP 8.5.1 or higher with NDK r28 or higher and compatible prebuilt libraries is 16 KB compatible by default.
- Test on a 16 KB emulator image, and confirm with
adb shell getconf PAGE_SIZE, which should return 16384.
Some third-party download pages still call a Quail build the current stable release, while Google’s install page lists Rabbit 2. Trust the official page, and recheck it before a new project.
How to Build a Signed App Bundle and Publish It on Google Play
Turn on R8 for the release build type, sign it with an upload key, build an Android App Bundle, and upload it to Google Play Console. New personal accounts add a closed test before production.
Start with the release build. Set isMinifyEnabled and isShrinkResources to true, which Google recommends doing together, with proguard-android-optimize.txt, since AGP 9.0 dropped support for proguard-android.txt.
AGP 9.3 and later replace this with an optimization block where enable = true. Turn it on only for the final version you test before publishing, because it lengthens builds and makes debugging harder.
If shrinking removes code the app needs, add keep rules for it. Obfuscated stack traces are harder to read, though recent AGP and Android Studio versions retrace them automatically in Logcat.
| Key | Held by | Can change? |
|---|---|---|
| Upload key | You | Yes, reset through Play Console |
| App signing key | Only through a key upgrade requested in Play Console |
Android App Bundles and Play App Signing are mandatory for new apps since August 2021. A bundle defers APK generation and signing to Google Play, which serves each device only the code and resources it needs.
- Click Build, then Generate Signed Bundle/APK, and select Android App Bundle.
- Create a new keystore (a .jks file), an alias and passwords. Set the validity to at least 25 years.
- Select the module, keystore path, key alias and passwords, then choose the destination folder and build type.
- Click Create.
- Raise versionCode above the previous upload for every later release.
- Upload the bundle to Google Play Console.
Before you hit upload, check these limits.
- Existing phone and tablet apps need to target at least API 35 to stay available to new users on newer Android versions (Android Developers, 2026).
- New Wear OS and Automotive OS apps need API 35, while new Android TV and XR apps need API 34.
- The maximum compressed download size is 4 GB, per Android Developers.
- Personal accounts created after November 13, 2023 must complete a closed test with 12 testers over 14 days (Google Play Console Help).
The extension option for the target API deadline ran until November 1, 2026, which has passed. A submission below the current target is now blocked.
Plan the closed test early. Production stays disabled until the criteria are met, the 14 days must be consecutive for each tester, and the production review usually takes seven days or less.
For testing before that point, the internal track deploys faster than alpha or beta and uses Play signing and shrinking, so it is closest to the store version. Firebase App Distribution suits CI pipelines.
Bundles do not support APK expansion (.obb) files. Losing the upload key is recoverable through a reset request and does not touch the app signing key, but without Play App Signing a lost signing key ends updates.
Android App Development with Kotlin FAQ
Should a new Android app use Kotlin or Java?
Kotlin. Jetpack Compose, Google’s modern UI toolkit, is built around Kotlin APIs, so Java has no path to the current UI stack.
Existing Java code keeps running in the same project, because the two languages interoperate.
Do you need to know Java before learning Android development with Kotlin?
Not really. Google’s first-app codelab lists basic Kotlin knowledge and the latest Android Studio as the prerequisites.
Older tutorials that start from Java and XML layouts are optional reading.
Can you build an Android app without Android Studio?
Yes. Google ships Android Command Line Tools for Linux, Mac and Windows, and Gradle runs the build.
You lose the Compose preview, which renders in the Design view of Android Studio, plus Layout Inspector.
Is Kotlin Multiplatform worth adding to a first Android app?
Not for a first app. Kotlin Multiplatform shares Kotlin code with other platforms such as iOS, and it adds project structure a first app does not need.
Ship the Android version first. Move shared logic out of the repository and ViewModel layers once they are stable.
How much does it cost to publish an Android app?
Google Play charges a flat US$25 registration fee, paid once (Google Play Console Help, checked November 2026).
You must be at least 18, and personal accounts also complete app testing requirements before distributing.
Which options cut download size besides R8 shrinking?
Turn on configuration APK splits with enableSplit = true, and convert features that only some users need into on-demand feature modules.
Both work because an App Bundle lets Google Play serve each device only the code and resources it needs.
Keeping a Kotlin Android App Compatible After Release
Android app development with Kotlin runs on a yearly cycle. You test the new API level and raise the SDK values, then ship an update before the Google Play deadline.
Android 17, API level 37, reached stable on June 16, 2026 (Android Authority).
Apps targeting API 37 lose the developer opt-out for orientation and resizability restrictions on screens with a smallest width of 600 dp or more, per the Android Developers Blog (2026). A portrait-locked layout breaks at that targetSdk, not before.
- Test on an API 37 emulator image.
- Raise compileSdk and library versions.
- Raise targetSdk last, then ship.
The order holds because the large-screen change takes effect at targetSdk, so that value is the last switch to flip.
Google’s target API page, updated October 28, 2026, lists API 36 as the highest required level, so the API 37 deadline is not yet published there. A published date would move this schedule.
- How to Redo in VS Code (Shortcuts and Fixes) - December 5, 2026
- Scaling Customer Support Without Losing Quality: A Practical Guide for Growing Companies - December 5, 2026
- Top MySQL CDC Tools for Streaming Changes to a Data Warehouse - December 4, 2026



