Gradle Stuck and taking long time after updating Android studio 3.0 stable update

柔情痞子 提交于 2019-12-31 02:00:31

问题


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:

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

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.


回答1:


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.




回答2:


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+




回答3:


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:


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:


Change the dependencies like:

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'


来源:https://stackoverflow.com/questions/46967876/gradle-stuck-and-taking-long-time-after-updating-android-studio-3-0-stable-updat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!