Android studio, configure gradle project takes forever

♀尐吖头ヾ 提交于 2019-11-28 19:11:54

If you are on Windows check

C:\Users\YOUR_USER\.gradle\wrapper\dists

whether the gradle 1.10-all is installed there or not inside the directory.

Android Studio downloads the whole distribution first time which is around 60 MB so it takes some time.

Check the distributionUrl in gradle/gradle-wrapper.properties and match the same in your dist directory if it is not available studio will download it. Distribution url will look like :

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

change it to whatever already installed will solve the problem.

Note : The directory name in dist and Zip name must same. Directory will be created while trying to download check whether the Zip is installed properly or not.

This could be anything, but in my case, it is due to an invalid HTTP proxy and some libraries can't be downloaded. In Settings-> HTTP Proxy, set to "None".

delete gradle folder in your project folder then reopen it using studio, in choose dialog choose cancel, don't use grade wrapper to download latest version of gradle

I solved it

  • deleting gradle and intellij files

    rm -rf .idea/ *.iml .gradle/
    
  • reimporting the project on intellij

  • choosing same jdk for gradle that you use on gradle terminal(makes sense if you use daemon)

  • and upgrading from gradle 2.4 to 2.13
Muneef M

If anyone face this sync stuck problem in mac, give this a try.

right click your

android studio.app -> show package -> content -> gradle

and see the gradle version. In that folder, now got to your android studio IDE and open your preference and go to

Build, execution -> build tool - > gradle

check the preference there. verify the path of gradle is as content - > .... and last there will be gradle version, see if that matched the gradle version in the content of androidStudio.app

guess this helps someone.

In my case the problem was Genymotion plugin.
Once i removed it from studio and restarted. It worked fine.

I still don't know how that could happen as i regularly use genymotion with studio in my other machines.

You can still run genymotion even if you remove studio plugin by starting emulator from genymotion itself.

I have centos 7 64 bits installed on a virtualbox 5.0.16 virtual machine and gradle version 2.10 with Android Studio 2.0

The log file of gradle is located at $HOME/.gradle/daemon/2.10 Log file: daemon-<some number>.out.log

By inspecting this log file I found out that libz.so.1 was not found by aapt.

Despite that command "locate libz.so.1" output was

/usr/lib64/libz.so
/usr/lib64/libz.so.1
/usr/lib64/libz.so.1.2.7

aapt was not able to find it.

In order to solve the issue I had to execute

yum install zlib.i686

Once installed, Gradle started compiling. Good luck!

What worked for me in this regard was , replacing the GRDADLE jar and properties file from the respective project that you may be trying to import .

  1. Build a project fresh or , copy the gradle jar and properties file from the working project
  2. Now , further copy these files and replace with the "Originaly" not working gradle files of the project you are trying to import or the project where gradle build hangs

Bit late , but can be of some help to the future queries .

In my case, I used a multi-project setup and included two separate projects in settings.gradle featuring some overlapping properties. I'm not sure which exact properties caused this, but they were most likely name-related. Basically, instead of throwing an exception ("duplicated [something] detected"), Gradle went into an endless loop. Replacing the duplicated properties helped.

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