Android Studio use behind company firewall

7,721 views
Skip to first unread message

Ivan Samuelson

unread,
Jul 21, 2014, 11:11:24 AM7/21/14
to adt...@googlegroups.com
I have a feeling this is due to my company's firewall. We do have a proxy that requires us to use our LAN ID and password to get to the internet, although it's an automatic proxy that uses LDAP to determine who we are. However, some apps will require us to enter the proxy address, port and our username and password. In Android Studio, I've set all of this up appropriately in the settings.

Also, we use McAfee and I had to turn off host UPS, network IPS and firewall and that allowed Gradle to go out to the internet and start the compilation process.

However, even after all of that, Gradle will eventually fail with the following:

Failed to refresh Gradle project 'My Application'
   
Error:Error:Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/'. Received status code 407 from server: Proxy Authentication Required
<a href="toggle.offline.mode">Enable Gradle 'offline mode' and sync project</a>


Again, all the proxy information is setup correctly.

Also, since I can never get an online compile to work, I cannot use offline mode as it doesn't have all the dependencies downloaded/cached yet. This is the one reason I do not like Gradle.

This works at home, which of course, we don't have a proxy and such (I do have a firewall, both via my router and Norton), but again, Android Studio works just fine there.

So, I'm wondering, is this due to my work's setup? Do we have to open up something in the firewall at work?

This is on a Windows 7 machine. And, they do have the machines locked down, but developers, such as myself, are given admin access. I've tried running AS both normally and telling it to run as admin, but it doesn't matter. I still get the same error.

Eclipse gives us no problem, but that's because it doesn't use Gradle and I'm really thinking of just sticking with Eclipse. It's what I'm used to, but it seems Android Studio might be the direction of the future, but I do not like the online requirement that is needed for at least the first compile. That puts an unnecessary constraint that I feel shouldn't be there. What if I'm working somewhere where I don't have internet connection and I want to start coding in AS? I can't do that.

Any help would be appreciated. I've search high and low and I've tried all the suggestions (including setting up the proxy information in the gradle.properties file) and nothing has worked.

Thanks!

Xavier Ducrohet

unread,
Jul 24, 2014, 2:31:11 AM7/24/14
to adt...@googlegroups.com
I would ask on the gradle forums how to properly set this up. It should be possible to make this work.


--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Scott Barta

unread,
Jul 24, 2014, 10:21:45 AM7/24/14
to adt...@googlegroups.com
There's a bit of documentation on settings you can add to gradle.properties at http://www.gradle.org/docs/current/userguide/build_environment.html

Ivan Samuelson

unread,
Nov 11, 2014, 8:56:58 AM11/11/14
to adt...@googlegroups.com
Yeah, I've tried all that. My only way to get this to work is to shut off the company network connection and then tether my phone and use my 4g internet through my phone. Then, I do an initial build and then after that, it works if connect back to my company's network.

Really a pain when I have to do this every time I create a new project. Not really good if you ask me. Gradle really needs to be fixed to work behind a proxy. 

Bryan Herbst

unread,
Nov 11, 2014, 9:36:49 AM11/11/14
to adt...@googlegroups.com
I have Android Studio working just fine from behind a proxy.

Does your company use its own CA certs? Gradle uses your JDK's JRE certificates, so you will need to import those certificates into your JDK's JRE cacerts keystore (typically located at jdk\jre\lib\security).

Doing this and setting up my gradle.properties with the proper proxy configuration enabled me to build my project.

Ivan Samuelson

unread,
Nov 21, 2014, 12:43:07 PM11/21/14
to adt...@googlegroups.com
At this time, with the Canary Channel, they have released the v1.0 release candidate for testing. This allows TRUE offline compiling by including the Maven repository. Of course, you'll have to be online the first time to download the repository, but after that, any time you create a new project, that's what it will use. No need to be online anymore. So, if you happen to be somewhere where you DON'T have internet connection (such as on a plane with no wifi, on public transportation with no wifi, or some deserted island), as long as you set up RC1.0 with the ability to connect to the internet, it will have download the repository and you can create new projects with NO need of internet access.

Works like a charm for me. 

Xavier Ducrohet

unread,
Nov 21, 2014, 12:58:48 PM11/21/14
to adt...@googlegroups.com
Note that there's some limitations.

The maven repo (our plugins with its dependencies) and the gradle distribution are bundled inside studio, so you only need to download the SDK on top of studio.

1. Obviously this only works if you use the right versions. We are planning on only including the latest version.
2. There is not difference with the older version if you had done a build once (populating the gradle ~/.gradle folder with caches).
The goal is mostly to allow for faster first time project creation so that you don't wait xx minutes after creating your project for Studio to download stuff.

3. This is limited in the way that it only works inside studio. The way we do it, Gradle won't use the bundled version to build its ~/.gradle cache. This means as soon as you build from the command line (the first time), it *will* download gradle and our plugins+dependencies from the internet. We are working on fixing this.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nirmal Patel

unread,
Dec 11, 2014, 6:36:38 AM12/11/14
to adt...@googlegroups.com
I am not even able to launch the latest Android Studio. It tries to download the SDK on first launch after installation and there seems to be no way to specify NTLM authentication settings for same.

I tried configuring vmoptions for Android Studio and android.cfg for SDK tools but no luck.

Tor Norbye

unread,
Dec 15, 2014, 11:33:20 AM12/15/14
to adt...@googlegroups.com
On Thu, Dec 11, 2014 at 3:36 AM, Nirmal Patel <nirmal...@gmail.com> wrote:
I am not even able to launch the latest Android Studio. It tries to download the SDK on first launch after installation and there seems to be no way to specify NTLM authentication settings for same.

You should be able to Cancel out of the setup wizard (as of 1.0 -- it wasn't possible in the RC's).

-- Tor 
Reply all
Reply to author
Forward
0 new messages