Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run flutter application with gradle in offline mode?

Tags:

gradle

flutter

I'm trying to run my flutter application, but when it resolving android dependencies it will timeout. in android studio I can change gradle in offline model. is there any way to set gradle offline mode in flutter. the android studio setting(gradle offline work model) isn't work for flutter.

like image 943
Anger Ran Avatar asked Jun 11 '19 09:06

Anger Ran


1 Answers

On Windows

  • Edit FLUTTER_PROJ_DIR/android/gradlew.bat
    • Add switch --offline in %JAVA_EXEC%
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% \
    %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" \
        -classpath "%CLASSPATH%" \
    org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% --offline

On *Nix

  • Edit FLUTTER_PROJ_DIR/android/gradlew
    • Add switch --offline in $JAVACMD
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" \
          org.gradle.wrapper.GradleWrapperMain "$@" --offline
like image 181
ebrahim alyousri Avatar answered Oct 09 '22 22:10

ebrahim alyousri