Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing activity_main.xml in new project in Android Studio

Note: I'm completely new to development in Android Studio.

I downloaded and installed the latest Android Studio (Flamingo 2022.2.1). Then I was trying to follow some beginners tutorials and created a new project (I selected Empty Activity).

The project opens and I can see the generated MainActivity.kt file. Similar to the tutorials.

Everything seems to be in order except that in my res folder there is no layout folder and consequently there is no activity_main.xml file.

Is this the expected behaviour for this version of Android Studio or am I doing something wrong?

EDIT: added screen capture for New Project option enter image description here

like image 827
TheMixy Avatar asked Sep 05 '25 03:09

TheMixy


1 Answers

Android 2022.2 switched from the classical views concept to Jetpack Compose, which does not require a layout defined in XML anymore. Everything is done in the Kotlin code instead. See the official Jetpack Compose introduction for more info.

However, this only means that Jetpack Compose is used in some templates for new projects. You are still able to develop apps the classical way. Just choose the Empty Views Activity template when you start a new project.

enter image description here

like image 117
Torben Avatar answered Sep 07 '25 23:09

Torben