Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run android studio first time when i'm offline?

I have no internet connection. I want to use android studio but it gives me Gradle sync errors every time I try to use it.

Is there a way to run android studio without internet?

Note that I have SDK and JDK running well.

Cant resolve jUnit error

My java codes are not resolved too. Java methods error

like image 422
Ali.Rashidi Avatar asked May 07 '16 09:05

Ali.Rashidi


2 Answers

Download the latest gradle file from here. Then in your Android Studio goto File->Settings->Build,Execution,...->Build Tools->Gradle. Then In the right side Check the "Use local gradle distribution" and then set the downloaded file as your gradle home. Below, in the Global gradle settings check the Offline Work option.->Click Ok.
DONE

But Even though doing this will let you create a simple android app, you won't be able to import any external libs.

like image 143
Akhil Soman Avatar answered Oct 14 '22 08:10

Akhil Soman


For Android Studio 2.3.0.8 (2/Mar/2017):

  1. Goto File->Settings->Build->Gradle, check "Use local gradle distribution" and change "Gradle home" to: [android-studio-path]\gradle\gradle-3.2 or whatever version there, and check "Offline Work" option there.
  2. Degrade the targeted gradle version of the project\build.gradle (not the app\build.gradle) like that (it was 2.3.0):

    dependencies { classpath 'com.android.tools.build:gradle:2.2.0' }

  3. Goto File->Project Structure->Modules->Dependencies, remove all but:

    {include=[*.jar], dir=libs} com.android.support.appcompat-v7:23.3.0 com.android.support.constraint:constraint-layout:1.0.0-alpha7

  4. Sync.


  • Be aware that the tricky IDE disables "Offline Work" option without notification, so you need to:

  • Firewall those or it will download without notification:

[android-studio-path]\jre\bin\java.exe [android-studio-path]\bin\studio64.exe|studio.exe

like image 36
captain_majid Avatar answered Oct 14 '22 07:10

captain_majid