Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Activity_main.xml on Android Studio

When I try to open the activity_main.xml I get Design editor is unavailable until a successful build.

I fixed it before by using the clean project and rebuild project but it does not work when I opened the file again. I tried the solutions found on this answer: Android studio design editor is unavailable until after a successful project sync but it didn't worked for me.

like image 915
Basil4532 Avatar asked Oct 19 '25 19:10

Basil4532


1 Answers

Well, you can create a new one.
step 1: Right Click on res folder, then create a new android resource directory and change the resource type to layout.

step 01

step 2: Right Click on the newly created layout folder, go to new and create a Layout Resource File. Name it as "activity_main.xml" and give it some time to load it.

step 02

step 02.1

step 3: Do not forget to include the activity_main.xml inside the MainActivity.kt using setContentView method and remove the setContent method as well as the codes below @composable if you want to avoid the default Jetpack setup.

step 3

Any doubt, just leave a comment.

like image 142
Souvik Dey Avatar answered Oct 22 '25 05:10

Souvik Dey