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 trialAlistair Ruff
3,272 PointsGradle project refresh fails upon starting the project
Hi,
The install of Android Studio seems to have worked smoothly, but after entering the new project details I click finish and it takes time to load, then gives the following error
"Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle."
I'm working on a university network and don't have access to change my browser proxy settings, is there a way I can still get this running?
Thanks
3 Answers
Harry James
14,780 PointsHello,
Unfortunately, Android Studio actually requires an Internet Connection for the Gradle Implementation (I know, what a bummer!). It sounds like your network provider at your university is blocking you access to the Gradle file. You can ask your university network administrator to grant you access to the blocked site. The URL will be something like:
http://services.gradle.org/distributions/gradle-1.12-all.zip
(This is what mine is but, my version of gradle is probably quite old). (You can find the latest version here - Just replace grade-1.12-all.zip with the appropriate file name
The alternative is to download the Gradle Implementation from home if possible (Or, copy the Gradle files over via USB/Email to your university account). Then, you can go to File >> Settings >> Project Settings >> Gradle and, under Global Settings, enable Offline work.
As for copying these files over, you should fine them in the directory C:\Users\yourusername.gradle. So, copying this folder onto a USB and then pasting its contents into the same directory on your University computer should make everything go fine.
If both of the above are not possible to you, the final alternative would be to use another IDE such as Eclipse. Things will be slightly different in the course by doing this so, you may need to ask on the forums if you get stuck. Hopefully, you shouldn't need to take this method as, I wouldn't recommend it if you are doing the Beginners stage (It's quite a hassle for learning if what you see on the video is different to what you have).
If you have any further questions, feel free to ask! :)
Alistair Ruff
3,272 PointsThanks for the reply, I've been travelling so am only catching up with this now.
After following your advice and messing up the installation of Gradle a few times it seems I've got it installed properly and returning the version in command prompt.
Unfortunately when I check offline working and re-load a project I get the following message:
Error:No cached version listing for com.android.tools.build:gradle:0.12.+ available for offline mode.
I'm attempting to sort it with IT Admin at this end too but any further help would be appreciated.
Thanks for your time!
Harry James
14,780 PointsHey Alistair!
If you're getting this message, it means that Android Studio is looking for a version of Gradle to use offline but, can't find one!
Go to:
File >> Settings >> Gradle >> Global Gradle Settings >> Service directory path and make sure the correct path is selected.
If you are sure you have it installed correctly, try these steps (Apparently, there is sometimes a bug):
1) Uncheck "Offline work" in File >> Settings >> Gradle >> Global Gradle settings 2) Restart Android Studio through File >> Invalidate Caches / Restart and select Invalidate and Restart. 3) Then, head back to the Global Gradle settings and activate Offline work.
Alistair Ruff
3,272 PointsHi Harry,
thanks for taking the time to help,
I've managed to resolve it now so it runs properly online rather than offline. Turns out I was missing a glaring omission.
I got the proxy info from my network admin at this end and was figuring out how to edit the proxy settings for gradle and was frustrated it still wasn't working, not realising I hadn't made the changes within Android Studio...
So I updated the proxy settings in Android studio and I'm up and running now!
Again, thanks for the help!
Harry James
14,780 PointsGlad to hear it's working!
Android Studio is a lot better with Online Functionality, too!
rsvuwipwnt
6,690 PointsHi, I get this issue but none of these things here fixed it for me. Can anyone help?
It all started when I was getting a hell of a lot of other issues before hand so just reinstalled Android Studio and decided to start my project again from scratch.