Android Studio waiting for build to finish

I have a problem. When I start a new project in Android Studio and select a navigation drawer activity it happens. I don't have access to my activiy_main_drawer.xml on "Design" and it keeps saying "Waiting for build to finish.". I really don't know what I have to do. I tried to uninstall and reinstall Android Studio, and it didn't help.


Solution 1:

I've just run into the exact same problem. I simply solved it by choosing Sync Project with Gradle Files. This will trigger a Gradle re-import and a build.

As of Android Studio v3.2, the icon is located near the top right tool bar. You can also find it using Find Action shortcut CtrlShiftA.

Solution 2:

You can do the following:

"File > Sync Project with Gradle files" (worked for me)

File > Invalidate Cache & Restart > Just Restart

OR

File > Invalidate Cache & Restart > Invalidate & Restart

Close Project and Re-Import the Project

Solution 3:

File -> Sync project with Gradle files

Solution 4:

What worked for me was, from the top menu:

Build -> Clean
Build -> Rebuild Project

After that the xml design worked

Solution 5:

Syncing gradle, reopening, rebuilding, invalidating caches and restarting, trying different Android studio versions. None of these helped. When I would open XML preview I would still see that damn issue.

What helped in the end is closing Android studio, going to gradle directory:

cd ~/.gradle/

And deleting caches folder:

rm -rf caches

After that reopening Android studio will take some time as it still has some rebuilding to do, but afterwards all xml layouts were being properly rendered again.