0
votes

I download basicSample project from below link of GitHub. When I want to sync project, I get below error. I searched and a i saw this link (How Update the gradle to 3.4.1in android studio), i try offline mode but again not worked. I was confused. Can't i sync gradle 3.4.0 online? Should i used offline sync? If yes how i set gradle and gradle plugin (I set path of gradle in settings but Android studio shows below message)?

  No cached version of com.android.tools.build:gradle:3.4.0 available for offline mode.
  Disable Gradle 'offline mode' and sync project

Github link:

https://github.com/googlesamples/android-architecture-components/tree/master/BasicSample

Error for sync gradle 3.4.0 for online mode:

 Could not find com.android.tools.build:gradle:3.4.0.
 Searched in the following locations:

- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.pom - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.jar - https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.pom - https://jcenter.bintray.com/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.jar - https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.pom - https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.jar - https://kotlin.bintray.com/kotlinx/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.pom - https://kotlin.bintray.com/kotlinx/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.jar - http://jcenter.bintray.com/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.pom - http://jcenter.bintray.com/com/android/tools/build/gradle/3.4.0/gradle-3.4.0.jar Required by: project : Open File

1
Make sure you have an active internet connection while syncing the project with a Gradle version which was not cached on your system earlier. You can try setting an older version of Gradle in your Project Settings ( File -> Project Structure ) - Shubham Panchal
I have no problem for connection. I have proxy because these services is blocked in my country :( but i don't think that was for internet connection. How can i work offline? I don't want downgrade gradle - Fahimeh Hashemian
@FahimehHashemian Please look at my answer for a possible solution - stackoverflow.com/questions/42701773/… - Leo240

1 Answers

0
votes

Here is your solution.

Follow the step to solve your problem.

  1. Go to File option.
  2. Click On Settings option. (Ctrl + Alt + S)
  3. There is an open new popup window, look at the left panel of that window.
  4. Expand Build, Execution, Deployment option.
  5. Click on Gradle option.
  6. Uncheck Offline work, Click Apply -> Ok.
  7. Sync the project.

As you can see in below pic.

enter image description here