After that the project sync , a sync error occurs that say "No cached version of com.android.tools.build:gradle:2.2.2 available for offline mode" How can I solve error, at the same time keeping my conputer disconnected from Internet
5 Answers
In Mac for android studio 3.6.1
it has been moved to view
-> Tool window
-> Gradle
and then finally toggle the offline mode
will be clicked, as shown in the screen shot with red arro

- 2,497
- 28
- 25
I got a solution to this problem.
Follow these simple steps:
Click File > Settings (on a Mac, Android Studio > Preferences) to open the Settings dialog.
In the left pane, expand Build, Execution, Deployment and then click Gradle.
- Under Global Gradle settings, UNCHECK the Offline work checkbox.
- Click Apply or OK for your changes to take effect.
It will fix the problem.
For the internet connection use the HTTP proxy for Android Studio
Following steps:
- From the menu bar, click File > Settings (on a Mac, click Android Studio > Preferences).
- In the left pane, click Appearance & Behavior > System Settings > HTTP Proxy. The HTTP Proxy page appears.
- Select Auto-detect proxy settings to use an automatic proxy configuration URL for the proxy settings or Manual proxy configuration to enter each of the settings yourself. For a detailed explanation of these settings, visit official website.
- Click Apply or OK for your changes to take effect.
Bests,

- 268
- 3
- 12
-
1tks my friend @yahme3 – FlipNovid Mar 12 '18 at 01:51
-
Glad to hear that it worked for you. Anytime @FlipNovid – meyasir Mar 13 '18 at 06:12
The cache is located at "c:\Program File\Android\Android Studio\gradle\m2respository\com\android"
Select the version which is available on you disk.

- 11
- 1
Actually it is not possible to cache a build gradle version in offline mode. To solve this you could:
1) Enable online mode in your Gradle tab properties. To do this simply press "Toggle online mode" button or
2) Downgrade to the gradle version which is already cached on your PC. For example, com.android.tools.build:gradle:2.0.2

- 385
- 2
- 12
I had this problem and what I did was simply run the gradle sync again with activating my internet connection and it took 3 minutes to sync and once it was done it just asked me to do the update for reflecting changes in all files and then its over.
I closed and opened my android studio again without internet connection and this time it synced properly. Try it...