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.
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 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 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.

Any doubt, just leave a comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With