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

拈花ヽ惹草 提交于 2019-11-29 07:27:33

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.

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

Another way is to add local dependencies for JUnit with jar files

https://github.com/junit-team/junit4/wiki/Download-and-Install

Download both files and copy them to your app/libs directory

And modify your build.gradle file as follow:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!