Gradle Stuck and taking long time after updating A

2019-02-25 07:02发布

I have updated Android studio to 3.0 stable release version. My project and its corresponding dependencies are working fine upto 2.3.3 Android version.

But since yesterday, Gradle build is taking so long and got stuck at processes while resolving dependencies. Please check below screenshot of build.gradle file:

enter image description here

I have checked gradle setting too, trying using Gradle wrapper or Local Gradle Distribution method, but no luck. Please see below setting :

enter image description here

And, my gradle-wrapper.properties file look like :

#Thu Oct 26 17:52:06 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

I tried Gradle clean / assemble / Sync project and every other approach before posting this question, but no luck.

Thanks.

5条回答
做个烂人
2楼-- · 2019-02-25 07:30

Change the dependencies like:

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
查看更多
男人必须洒脱
3楼-- · 2019-02-25 07:39

I've experienced the same problem yesterday. After upgrading from Android Studio 2.3 to 3.0, it took a long time to build the project. First, you need to waiting for the Android Studio to download the gradle if you don't use the local gradle. Second, you need to clear by File->Invalid Caches/Restart. Last, you need to delete the .gradle.

查看更多
一夜七次
4楼-- · 2019-02-25 07:39

sometimes this error happens when it is blocked in your country,then you need to use a VPN like hotspotshield this worked for me

查看更多
趁早两清
5楼-- · 2019-02-25 07:40

Since you upgraded android studio to a newer version, the version of gradle will also be updated.

The message "Refreshing project" means a new version of gradle is being downloaded. About 100MB of file will be downloaded in the meantime.

So make sure you have a stable internet connection and wait for some time till the download completes.

Another possibility:

You have used com.android.tools.build:gradle:2.3.3 in your build.gradle file. Use the corresponding version of gradle as the version of Android Gradle Build Plugin. So use com.android.tools.build:gradle:3.0.0 with Gradle 4.1+

查看更多
唯我独甜
6楼-- · 2019-02-25 07:46

How I resolve this issue, after upgrading to Android studio 3.0 :

  1. Changed old build version to at least: buildToolsVersion "26.0.2"
  2. Changed compile to implementation
  3. Changed testCompile to androidTestImplementation
  4. Changed older classpath version to 'com.android.tools.build:gradle:3.0.0'
  5. If using local gradle distribution then verify distributionUrl as 4.1-all.zip
  6. Deleted .gradle folder then Clean / Rebuild.

It worked. Thanks.

查看更多
登录 后发表回答