skip to Main Content

I am not getting any layout(.xml) file while creating an empty activity on android studio. It is said to be created on its own but I can not find the activity_main.xml; It was alright for the first project that I made and it’s somehow not working now.

I have tried every thing from reinstalling the app to deleting old projects. I tried to initiate other activities ,they all are working fine,but its a specific problem with empty activity, also I am not getting any option to choose my language; though it is creating a .kt file but the logo appears different from my first project. It would be of great help if anyone could provide a good advice.

2

Answers


  1. Please select generate layout file checkbox when you are creating empty activity and i also attach screen short please check

    Login or Signup to reply.
  2. In current version of Android Studio, New Android Activity dialog -> Empty Activity will create a Activity building the UI with Jetpack Compose, you have to write composable functions to describe the UI just in the YourNewActivity.kt file and without any xml file.

    If you are trying to build traditional View system (which using the XML file to build UI and findViewById something), you should choose Empty Views Activity from the New Android Activity dialog.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search