Thursday, 15 January 2015

Alternative to downloading gradle while generating project with libgdx Project generator

Problem : If you are generating a libgdx project using the gdx-setup.jar and it starts downloading the gradle zip named like "gradle-2.2-all.zip" , but it is taking too long or you do not have an internet connection, then this post may help you.
Solution : Download the zip file manually (~55Mb) and feed it to your project generator. Here is how :
1. goto https://www.gradle.org/downloads and download the desired gradle version. OR get the direct url in the "distributionUrl" attrubute in the file "ProjectURL/gradle/wrapper/gradle-wrapper.properties" where ProjectURL points to the project folder (Destination as described in the GUI of project generator).

For linux Users :
2. In the same file "gradle-wrapper.properties" have a look at the value of attribute "zipStorePath" and place the zip file on that path. e.g. :
zipStorePath=wrapper/dists
then create a new folder "dists" whithin wrapper folder and place the downloaded zip file in it.

For Windows Users:
2. Place the downloaded file in the subfolders of C:\Users\code\.gradle\wrapper\dists\gradle-2.2-all
3. Close the project generator jar and run it again. This time it won't have to download the gradle file because it is already there.
Tried On : Libgdx generator release 1.5.2 and gradle 2.2
May also work with : other versions of libgdx and gradle

3 comments:

  1. But when I import the project using android studio it stuck at Building gradle info for hours

    ReplyDelete
    Replies
    1. You are not alone in this Khalid. Android Studio does take a lot of time importing projects. I hope once it completes importing you wont face same problem again.

      Delete