Android Activity Main xml stuck loading

While recently working on the new Android Studio 4.X, I can across an issue where when I clicked on the activity_main.xml resource file, it did not open instead I could see a loading icon stuck in an infinite loop. I was able to resolve it and seems below could be one of the reasons if you too are facing the same issue.

If you see the above screenshot, you could see that I have two processes running, the top process is trying to download Gradle packages and the bottom one says "indexing paused due to Import "MyApp" Gradle project". So that means the project is not indexed yet and waiting for the above process to complete.


I waited for Gradle process to complete - it took ~10 mins and I was able to open activity_main.xml again :)


  • Faced the same issue, I guess its because I did a fresh install of the IDE and the first run is slow isn't it?
    anon 19 Sept 2020 10:32:01 GMT
  • Did not work for me? What may be the other reasons for this? Can you help?
    user135 07 Aug 2020 11:23:13 GMT
  • Ah! Thank you, had the same issue.
    user2934 02 Aug 2020 16:08:21 GMT
  • Further comments disabled!
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.