The idea
Two projects, one app on the phone
The phone knows an app by its applicationId, not by its folder or its language. Lab 2 keeps Lab 1’s: its Notes replaces Lab 1’s, and each part shows Lab 1’s screen beside the new one.
Lab 2, as the wizard writes it
plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.compose)}
android { namespace = "com.yourname.notes" compileSdk { version = release(37) }
defaultConfig { applicationId = "com.yourname.notes" minSdk = 24 targetSdk = 37 versionCode = 1 versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" }
buildTypes { release { optimization { enable = true packageScope = setOf("androidx.**", "kotlin.**", "kotlinx.**") } } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } buildFeatures { compose = true }}
dependencies { implementation(platform(libs.androidx.compose.bom)) implementation(libs.androidx.activity.compose) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.ui.graphics) implementation(libs.androidx.compose.ui.tooling.preview) implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) testImplementation(libs.junit) androidTestImplementation(platform(libs.androidx.compose.bom)) androidTestImplementation(libs.androidx.compose.ui.test.junit4) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.junit) debugImplementation(libs.androidx.compose.ui.test.manifest) debugImplementation(libs.androidx.compose.ui.tooling)}namespace: the package of your Kotlin code.applicationId: the app’s name on the phone, the same as in Lab 1.
On the phone, at step 0.4


- applicationId the same: one Notes icon on the phone, Lab 2’s.
Lab 1 The same two lines 1 min
plugins { alias(libs.plugins.android.application)}
android { namespace = "com.yourname.notes" compileSdk { version = release(37) }
defaultConfig { applicationId = "com.yourname.notes" minSdk = 24 targetSdk = 37 versionCode = 1 versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" }
buildTypes { release { optimization { enable = true packageScope = setOf("androidx.**", "kotlin.**", "kotlinx.**") } } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 }}
dependencies { implementation(libs.appcompat) implementation(libs.material) implementation("androidx.constraintlayout:constraintlayout:2.2.2") testImplementation(libs.junit) androidTestImplementation(libs.espresso.core) androidTestImplementation(libs.ext.junit)}Lab 1’s build.gradle.kts holds the same two values. Only the folder differs: Notes for Lab 1, NotesCompose for Lab 2.
Before you start
By the end you can
- read a line of Kotlin beside the Java you know;
- create a Compose project with Empty Activity, under Lab 1’s package;
- run it: “Hello Android!” replaces Lab 1’s Notes on the phone.
- At home the Kotlin sheet
- Android Studio Welcome · New Project
- Emulator Running Devices
On a Mac What changes 1 min
- Cmd replaces Ctrl, and Option+Enter replaces Alt+Enter.
- The project folder is
~/AndroidStudioProjects/NotesCompose. - The rest is the same. This page is tested on Windows only.
Step 1 of 4
Read the Kotlin sheet
Goal Read the ten cards once: each puts a Kotlin line beside the Java you already know.
- At home your browser
-
The sheet, open in a tab of its own.
- Open Read Kotlin in ten minutes: it opens in a new tab.
- Read its four rules at the top, then its ten cards, in order.
- Card 8,
{ }after the call, is the one every screen of Lab 2 uses: read it twice. - Keep the tab: each part links to the card a new line needs.
Why You do not write Kotlin from memory in Lab 2: you read it, then type short lines the sheet explains.
Step 2 of 4
Start a project with Empty Activity
Goal Start from Empty Activity, the template that writes a Compose screen: in Lab 1 you chose No Activity.
- Android Studio Welcome · New Project
-
A new project, from the Compose template.
- Android Studio opens on Lab 1’s Notes? Click FileClose Project: the Welcome window opens.
- In the Welcome window, click New Project.
- A New Project window opens: click Phone and large screens, in the list on the left.
- Click Empty Activity, selected by default. Not Empty Views Activity, and not No Activity.
- Click Next: the form of step 0.3 opens.
New Project A dialogFull size
- Phone and large screens: the category.
- Empty Activity: the Compose template, the one to keep.
- No Activity: Lab 1’s template, no screen at all.
- Empty Views Activity: a screen in XML, not Compose.
Stuck? 2 symptoms
- No Close Project in the File menu Use FileNewNew Project instead: the same window opens, and the project opens in a new window.
- You chose Empty Views Activity It writes an XML layout, as in Lab 1. Delete the project’s folder, then start again with Empty Activity.
No project file yet: the next step writes them.
Step 3 of 4
Fill in the form, keep Lab 1’s package
Goal Create Notes in Compose, with Lab 1’s package, in the folder NotesCompose.
- Android Studio New Project › Empty Activity
-
Your package name, the one of Lab 1.
- The field below shows the package this browser kept from Lab 1. Empty? Type yours:
com.yourname.notes.
Without JavaScript, the code says com.yourname.notes: replace yourname by the name you chose.
- The field below shows the package this browser kept from Lab 1. Empty? Type yours:
-
The form: Notes, your package, NotesCompose, API 24.
- The page Empty Activity opens. In Name, select the text with Ctrl+A, then type
Notes. - Package name becomes
com.….notes: it must be the package in the field above. If not, select it with Ctrl+A, then type it:com.yourname.notes. - Save location ends in
Notes2, since Lab 1’sNotesexists: changeNotes2toNotesCompose. - In Minimum SDK, keep API 24 (Android 7.0).
- Click Finish.
New Project › Empty Activity A dialogFull size
- Package name:
com.yourname.notes, Lab 1’s. - Save location:
…\.AndroidStudioProjects\ NotesCompose - Minimum SDK: API 24 (Android 7.0).
- The page Empty Activity opens. In Name, select the text with Ctrl+A, then type
-
Android Studio, open on NotesCompose.
- The project opens on
MainActivity.ktand syncs by itself: wait 1 to 2 minutes, until the progress bar at the bottom right is gone. - A balloon says Kotlin version 2.4.0 is available: ignore it, and every other version update.
- A balloon, Microsoft Defender may affect IDE, may appear: ignore it.
- The project opens on
Why Keep Notes exactly: the theme is then NotesTheme, as in the code you paste later. The lab is built on the versions the wizard writes: keep them.
Done I see MainActivity.kt open, and app and Gradle Scripts in the Project window.
Stuck? 3 symptoms
- The package is not Lab 1’s (
….notes.compose, another name) It still works, beside Lab 1: two Notes on the phone. Type that package in the field above, so each page’s code uses it. - The folder stayed
Notes2It works too. The pages sayNotesCompose: your project is inNotes2. - The sync fails, or never ends The first sync downloads the Compose libraries. Connect to the Internet, then click FileSync Project with Gradle Files.
No file of yours yet: the wizard wrote the whole project. Part 1 shows you around it.
Step 4 of 4
Run it once
Goal Run the template on the Pixel 7: “Hello Android!” takes the place of Lab 1’s Notes.
- Android Studio Device Manager · Run
- Emulator Running Devices
-
The phone, inside the project.
- Click Device Manager, its icon on the window’s right edge.
- Click ▶ on the Pixel 7 row.
- The phone opens in Running Devices: wait for its home screen.
-
The template, built and on the phone.
- Click ▶ Run 'app' in the toolbar, or press Shift+F10.
- The first build takes a few minutes. Then the app opens on the phone.
Why Same applicationId as Lab 1: Android installs Lab 2 over it. Lab 1’s project stays on your disk.

You should see “Hello Android!” in small letters at the top left, on white, just under the status bar.
Done I see “Hello Android!” on the phone.
Stuck? 3 symptoms
- “Installation did not succeed … signatures do not match” A Lab 1 built on another PC is on the phone. Uninstall Notes on the phone, then click ▶ again.
- BUILD FAILED: “jlink executable … does not exist” A Gradle process left by VS Code: see If it doesn’t work, below.
- The phone opened in its own window, not in Running Devices You started it from the Welcome window. Close that window, then start it from the project’s Device Manager.
No file changes in this step: the build only reads the project.
If it doesn’t work
- BUILD FAILED: “jlink executable …\.vscode\extensions\redhat.java-…\bin\jlink.exe does not exist” Android Studio reused a Gradle process that VS Code left running on its own Java. Close VS Code. In Android Studio’s Terminal, type
.\gradlew --stop, press Enter, then build again (▶, or Build & Refresh in the preview). - The build asks for compileSdk 37.1 A version update was accepted. In Gradle Scriptslibs.versions.toml, set
composeBom = "2026.02.01", then click Sync Now.
The shortcuts of this lab
- Shift+F10: ▶ Run 'app', build and open the app on the phone.
- Ctrl+Shift+F5: Build & Refresh, the preview drawn again (Part 1).
- Alt+Enter: the quick fix, for example a missing import.
- Ctrl+Space: completion.
End of the part
Recap
The Compose libraries are downloaded, and the project runs under Lab 1’s package: one Notes on the phone. That’s all for tonight. In class, you open MainActivity.kt and look for the layout.
- read a line of Kotlin beside the Java you know;
- create a Compose project with Empty Activity, under Lab 1’s package;
- run it: “Hello Android!” replaces Lab 1’s Notes on the phone.

