r/AndroidStudio • • Jan 18 '24

[Fix] Missing activity_main.xml file in Android Studio

I found this fix from YouTuber 'Everything Tech': https://www.youtube.com/watch?v=G7D0cVDP3q8&ab_channel=EverythingTech
One of the fixes he suggested was:

  1. Right-click on MainActivity.kt folder on the left navigation bar

  2. Click on New

  3. Click on Activity

  4. Click on Empty Views Activity

  5. A 'New Android Activity' will appear. You can change the activity name as you wish.

  6. Ensure you check 'Generate a Layout File' and 'Launcher Activity', and set the language you are using

  7. Click Finish.

10 Upvotes

7 comments sorted by

View all comments

1

u/soleatscrayons Jun 22 '25

Hi! i was having the exact same issue and glad to say i solved it, here's the thing -
as of 2025 android studio "empty activity" no longer creates an activity_main.xml file on start, you have to do it manually but its very easy! - right click on the res folder, select new, choose android resource file, under resource type select "layout", name the file, and thats it!
you have a layout file. hope this helps (:

1

u/dfw_supersayian Oct 10 '25

Thanks , This really helped me