How do I set up Android Studio to work completely offline?
Asked Answered
R

13

76

I have very slow bandwidth, so I'm trying to keep all the required files on the local machine to work with Android Studio completely offline. When I click on "New Project" it always tries to download a file named gradle-1.6-bin.zip which I downloaded and tried to install locally via the plugin manager but it gives me an error:

fail to load plugin descriptor from file gradle-1.6-bin.zip

So what other files do I need to download and how do I install them properly to work offline with Android Studio?

Richellericher answered 10/8, 2013 at 2:12 Comment(1)
It looks like this is a common problem: (code.google.com/p/android/issues/…) that hasn't been resolved yet... :/ I don't have AS installed on this machine but if I did I would test a machine connected to the internet and use a tool like wireshark to monitor any requests and pull all the requested files (and possibly set up a local http server and modify your hosts file to redirect connections to the Android Studio host to your localhost'ed server).Leakage
R
13

OK guys I finally overcame this problem. Here is the solution:

  1. Download gradle-1.6-bin.zip for offline use.

  2. Paste it in the C:\Users\username\.gradle directory.

  3. Open Android Studio and click on the "Create New Project" option and you will not get this error any more while offline.

    You might get some other errors like this:

    Don't worry, just ignore it. Your project has been created.

  4. So now click on "Import Project" and go to the path C:\Users\username\AndroidStudioProjects and open your project and you are done.

Richellericher answered 17/8, 2013 at 12:4 Comment(1)
Assume, dependency jars (gradle-x.y.z-all.zip), gradle-x.y.z.jar, gradle-x.y.z.pom are available with us. Could you please advise the path where to put them in android studio or sdk!Brandish
H
29

Android Studio 0.4.0 now includes support for offline:

http://tools.android.com/recent/androidstudio040released

"You can now open the Compiler > Gradle options and enable Offline mode, which will tell Gradle to ignore update-to-date checks"

Updated Nov 2018: Now you can Open preferences, then search for "offline" and in the results select gradle and click "Offline work"

Huoh answered 28/1, 2014 at 17:14 Comment(5)
This checkbox is not working even in version 1.1, you can check here plus.google.com/u/0/115692564989237473252/posts/LGSbniYqj3QBeeson
But you have to build it online once to be enable to do it offline latersAzalea
I got the idea to auto generate mipmap images of various resolutions of an image from this link. I have been looking for that for a ling time now. ThanksNomadic
How to open compiler at first place. Im not anle to find compilerLuci
@ShirishHerwade - Open preferences, then search for "offline" and in the results select gradle and click "Offline work"Huoh
S
21

Android Studio Version < 3.6:

For Windows:

File -> Settings ->Build, Execution,Deployment -> Build Tools -> Gradle

For Mac OS:

Preferences ->Build, Execution,Deployment -> Build Tools -> Gradle

Check/UnCheck Offline work checkbox as per your need.

Android Studio Version >= 3.6:

follow steps in the image:

enter image description here

Sofiasofie answered 29/5, 2020 at 4:28 Comment(2)
Wow, I never knew there is this option. Only downside when i press this button is that i dont know if its turned off or on.Cucurbit
if it's turned on, the button will appear with a dark grey background, if not then the background will be clear. as shown in the image, its background is not dark grey and so it's not selected/turned-onSofiasofie
A
20

I'm using Android Studio 0.5.4 (Mavericks).

Preferences → Gradle → Global Gradle Settings → Offline work

Antiquary answered 4/4, 2014 at 3:50 Comment(1)
Does that work for you? It hasn't really done anything for me, and it looks like it isn't even really designed to let you work without internet: https://mcmap.net/q/270228/-does-android-studio-need-internet-connection-to-build-projectRecline
R
13

OK guys I finally overcame this problem. Here is the solution:

  1. Download gradle-1.6-bin.zip for offline use.

  2. Paste it in the C:\Users\username\.gradle directory.

  3. Open Android Studio and click on the "Create New Project" option and you will not get this error any more while offline.

    You might get some other errors like this:

    Don't worry, just ignore it. Your project has been created.

  4. So now click on "Import Project" and go to the path C:\Users\username\AndroidStudioProjects and open your project and you are done.

Richellericher answered 17/8, 2013 at 12:4 Comment(1)
Assume, dependency jars (gradle-x.y.z-all.zip), gradle-x.y.z.jar, gradle-x.y.z.pom are available with us. Could you please advise the path where to put them in android studio or sdk!Brandish
M
13

Android Studio 1.3.1 has neither

Gradle > Global Gradle settings > Offline work

nor a

Compiler

menu. To access the compiler menu, go to :

File > Settings > Build, Execution & Deployment > Compiler > Compiler

and de-select Configure on demand

The above still uses data but is faster, I was able to load images and maps. However, in addition, if you want to be completely offline, you need to do the following:

 File -> Settings ->Build, Execution,Deployment -> Build Tools -> Gradle -> 

check Offline work

Click the OK button.

For Android Studio 2.0 it is the same procedure.

Menashem answered 21/6, 2016 at 11:20 Comment(2)
Along with the offline mode, we have to change distrbutionURI to something like distributionUrl=file:///home/foo/downloads/gradle-2.2.1-all.zipPolicy
Assume, dependency jars(gradle-x.y.z-all.zip), gradle-x.y.z.jar, gradle-x.y.z.pom are available with us. Could you please advise the path where to put them in android studio or sdk!Brandish
K
3

Just as an assist if you go with Android Studio 0.4.x offline mode (because this thread is one of the main ones that google throws up when querying this issue).

From Alex Ruiz (Google+):

If you specify dependency versions using "+" (e.g. 0.8.+) Gradle (not Android Studio) will check that you have the latest version of such dependency periodically (every 24 hours,) even in offline mode

You need to take the plus out.

Kansu answered 14/2, 2014 at 0:59 Comment(0)
A
3

On Android 0.5.1 you can find the offline option in the File / Settings / Gradle (in the Project Settings section)/ Offline work

Assure answered 15/3, 2014 at 16:51 Comment(0)
G
3

Not sure if it was removed before, I heard it was kinda buggy in 0.5.8 but in AS 0.5.9 the settings is there:

Gradle > Global Gradle settings > Offline work

Graduation answered 3/6, 2014 at 13:51 Comment(0)
V
2

For enabling Offline mode Android Studio Version Above 3.6, refer the following answer.

https://mcmap.net/q/107878/-android-studio-gradle-takes-too-long-to-build

Verde answered 3/10, 2020 at 3:3 Comment(0)
C
1

You can enable from File->Build, Execution, Deployment->Build Tools-> Gradle-> Offline Work.

Coontie answered 23/6, 2016 at 11:8 Comment(0)
K
1

File > Settings > Build, Execution, Deployment > Gradle > Offline work

Ketti answered 6/8, 2018 at 10:28 Comment(0)
F
1

for a complete offline android studio 3.5.0 installation - you need to download all these below components

android studio, gradle, android gradle plugin and sdk.

here is a detailed step by step Stackoverflow answer for the question

how to install android studio full offline

Formulaic answered 12/2, 2020 at 16:29 Comment(0)
T
0

It seems as though gradle was not installed for me. Going to Android/Sdk/tools/templates/gradle/wrapper and running ./gradlew tasks --debug has resulted in it downloading.

Trifid answered 26/7, 2015 at 13:30 Comment(1)
This did indeed work, but my project wouldn't start building yet nonetheless. I chose the option to build it once with the online option (which popped up as an option in the console after build failed) and Android Studio started downloading and installing all the missing files. This did it for me, now building also works without an internet connection. I had to check the offline option again, however (File->Settings->Search for 'gradle' and check the offline option).Enzyme

© 2022 - 2024 — McMap. All rights reserved.