bond bond - 1 month ago 13
Android Question

Android Studio 4.0 stuck refreshing, can't run project

I just upgraded my Android Studio from 3.7 to 4.0. After upgrading, I changed the gradle dependency to 0.7.+ as indicated in the release notes.
Now, the IDE is stuck with a background task that says it is "Refreshing" my project.
I cannot run the project or do anything as those gets queued behind this task.

Note: it did a maven central update of about 100 MB before which completed successfully.

Answer

This is how I resolved it

Step 1: Modify build.gradle

Open the build.gradle in your module (not the top-level build.gradle file) Change the following (or something similar

classpath 'com.android.tools.build:gradle:0.7.+'

to

classpath 'com.android.tools.build:gradle:0.6.+'

Save.

Step 2: Restart Android Studio

Step 3: Fix build.gradle

Android Studio will nag you about Gradle version. Let it fix it. (You might have to manually change it to 0.7.+).
Click on Sync Project with Gradle Files then gradle will download the dependencies and it's fixed.