Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (2014) Getting Started with Android Creating the Fun Facts Project

Sante Kotturi
Sante Kotturi
7,434 Points

Best practice for installing Gradle?

I've tried installing Gradle two ways:

1) using homebrew: $ brew install gradle

This installs Gradle in /usr/local/bin/gradle

I then set my Gradle location in Android Studio > Preferences > Gradle > Service Directory Path

At the time I was trying to import an android project form existing source code. AStudio asked me select where Gradle was installed, when I pasted the result from:

$ which gradle = /usr/local/bin/gradle, it said invalid directory.

then: $ brew uninstall gradle to remove any conflicts and then

2) Downloaded Gradle version 2.1 from their website, I then got some errors about AStudio wanting gradle vers 1.1.... I think I fixed those by updating some additional tools in the SDK manager although I'm not sure exactly what. Either way, that errors seems to have left, for the moment.

I'm now trying to start the Android Project in this series and when after the initial project setup, AStudio seems to be redownloading Gradle every time despite having it installed.

My question is what is the best recommended way of installing Gradle and making sure its all hooked in. I'm used to using homebrew for all the setup magic but this seems to be an exception to the rule. I am currently using the Yosemite Preview, perhaps that's messing everything up...

Sante Kotturi
Sante Kotturi
7,434 Points

No Gradle love in this neck of the woods?

Gary Reck
Gary Reck
3,494 Points

Stumbled upon this today, you can use brew version of Gradle with Android Studio. When asked you point AS to look for Gradle in its real location, which is in the Cellar (e.g. /usr/local/Cellar/gradle/2.1/libexec).

You didn't actually install Gradle into /usr/local/bin/gradle, if you check ls -l gradle in bin you can see that it actually a symlink to bin/gradle under Cellar and that its installed location.

1 Answer

Sante Kotturi
Sante Kotturi
7,434 Points

After working through a couple android projects, having the gradle version from the website (not homebrew) and setting the Android Studio > Preferences > Gradle > Service Directory Path to be where I unpacked Gradle seems to be working (doesn't redownload every time or throw errors).

Sante Kotturi
Sante Kotturi
7,434 Points

Wouldn't mind if a couple people could verify that this works for them as well before selecting it as the best answer. Maybe some reasons for why the homebrew version doesnt work with Android Studio? Missing file in what homebrew downloads that AS is expecting?