"No cached version... available for offline mode." - android

I received an error message while building a new Hello World project in Android Studio:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MyApplication2'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:0.9.1.
Required by:
:MyApplication2:unspecified
> No cached version of com.android.tools.build:gradle:0.9.1 available for offline mode.
BUILD FAILED
Android Studio version: 0.5.2
Gradle version: 0.9.1
I'm using a proxy connection to Internet.

With the new Android Studio 3.6 to toggle Gradle's offline mode go to View > Tool Windows > Gradle from the menu bar and toggle the value of Offline Mode that is near the top of the Gradle window.

Had the same error after updating Android Studio today. For me, it wasn't a matter of proxy settings:
Uncheck "Offline work" in Android Studio 0.6.0:
File->Settings->Gradle->Global Gradle Settings
or in OSX:
Preferences->Gradle->Global Gradle Setting
or in more recent versions:
File->Settings->Build, Execution, Deployment->Build tools->Gradle
Resync the project, for example by restarting the Android Studio
Once synced, you can check the option again to work offline.
(Only tested in Gradle version 0.11... and Android Studio version 0.6.0 Preview)
EDIT : Added paths for different versions/platforms (as mentioned by John Ballinger and The_Martian). Not yet verified.

Please follow below steps :
1.Open Your project.
2.Go to the Left side of the Gradle button.
3.Look at below image.
4.Click button above image show.
5.if this type of view you are not in offline mode.
6.Go to Build and rebuild the project.
All above point is work for me.

Just happened to me after upgrading to Android Studio 3.1. The Offline Work checkbox was unchecked, so no luck there.
I went to Settings > Build, Execution, Deployment > Compiler and the Command-line Options textfield contained --offline, so I just deleted that and everything worked.

I had same error...Please Uncheck the offline work in Settings.
File => Settings => Build, Execution, Deployment => Build Tools => Gradle => Offline Work
After Gradle Sync Finished, Please Restart Your Android Studio.

click on right second one image .
file -> invalidate and Restart .
It will work for me please try !!!

For mac, Uncheck Offline Work from Preference -> Build, Execution, Deployment -> Build Tools -> Gradle -> Global Gradle Settings
tip: cmd+, to open Preference via shortcut key

Since you mention you have a proxy connection I will tell you what worked for me:
I went to properties (as friedrich mentioned) ensuring the Offline Work was unchecked.
I opened up the gradle.properties file in the IDE and added my proxy settings. Here's a generic version:
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
Then at the top of the properties file in the IDE there was a "Try Again" link which I clicked. That did it.

New Solution (Due to the redoing of Android Studio)
File -> Settings -> Build, Execution, Deployment -> Compliler
In the line Command-line Options delete: --offline

In my case I get the same error title could not resolve all dependencies for configuration
However suberror said, it was due to a linting jar not loaded with its url given saying status 502 received, I ran the deployment command again, this time it succeeded.

For new UI, click the icon cloud to enable/disable offline mode.

Related

gradle 3.2 failed to sync in android studio 3.2

i just downloaded the android studio 3.2 and it cannot sync my new project gradle.
i m using a proxy and i entered the proxy details in setting too. but i get this error:
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.0/gradle-3.2.0.pom'. Received status code 407 from server: Proxy Authentication Required
Enable Gradle 'offline mode' and sync project
i downloaded the file with google chrome.
when i use the 'offline mode' in gradle , i get this error:
No cached version of com.android.tools.build:gradle:3.2.0 available for offline mode.
Disable Gradle 'offline mode' and sync project
what should i do?
i added this proxy details to the gradle.properties and it worked.
if you wanna find gradle.properties go to C:\Users\youruser.gradle and you find it.
systemProp.http.proxyPort=your port
systemProp.http.proxyUser=vpn username
systemProp.http.proxyPassword=vpnpass
systemProp.https.proxyPassword=vpn pass
systemProp.https.proxyHost=vpn ip
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.http.proxyHost=vpn ip
systemProp.https.proxyPort=your port
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyUser=vpn username
sometimes if you use your username and password in android studio setting, it doesn't work.
///////////
*****first check if the android studio can use your proxy without giving it the information.you can check the (no proxy) box in setting>appearance and behavior>system setting>http proxy, and try to rebuild the project
Go to :
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
And then uncheck the offline work.
If you have idea on running offline mode do this.
Go to folder that you have already created project (build using online mode) for example C:\users\user\AndroidStudioProjects\project1.
After that create a new project in Android Studio. And build it in offline mode.
It shows same error. Now copy the .gradle and app folderfrom first project folder to second project folder.
Now build and sinc project it will run perfectly.
For this you should have atleast one "Hello World" project already build using online mode. After that copy this for all other projects.

Sync fail in android studio

Unknown host 'maven.parse.com'.
You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
getting this error and not build project
also not visible Run icon. Please check this image
Go to File->Settings
Search For Gradle in the search box and then uncheck the Offline work checkbox and then try to sync project.

Gradle Project Sync failed in Android Studio 2.3.1

Upon reopening Android Studio after an improper shutdown, my gradle project sync failed and many errors like: "Failed to resolve: junit:junit:4.12" started showing up in the Event Log. Screenshot is given below.
I tried the following things to no avail:
Updated Android Studio to ver 2.3.1 and thus also the Gradle
I also had error for "Plugin Error: required plugin "xyz" is disabled" so i deselected all the plugins showing errors from settings and reselected them which removed the error.
Then i went to Files -> Invalidate caches/restart
What should i do?
UPDATE: After clicking on "Disable offline mode and sync project", this is what happened.
Here is a working solution..
Step 1)
In Android Studio go to File > Project Structure
there unticheck "Use Embedded JDK" and below choose your JDK location..
Step 2)
Go to file gradle > wrapper > gradle-wrapper-proparties
change gradle version to 3.5-all
Step 3)
close the project and reopen
From your first screenshot
Gradle is in offline mode, which means that it won't go to the network to resolve dependencies.
Go to Preferences > Gradle and uncheck "Offline work".
After that try cleaning the project and Re-running again?
What worked for me;
Go to Preferences > Gradle & uncheck "Offline work"
Goto File > Invalidate caches and restart.
The project would restart and can begin to install dependencies. Dont worry if it takes a time, that could be due to slow network. Just go and sip coffee while you wait ;)

Gradle sync failed: Could not determine artifacts for com.android.support:recyclerview-v7:24.0.0

I am unable to sync my build.gradle the below error is showing
Gradle sync failed: Could not determine artifacts for
com.android.support:recyclerview-v7:24.0.0: No cached version
available for offline mode
To solve this use this way.
Uncheck Offline work in Android Studio
go this way
File->Settings->Build, Execution, Deployment->Build tools->Gradle.
Resync the project, by restarting the Android Studio.
Once synced, you can check the option again to work offline.
Setting->Build,Execution,Deployment->Build tools->gradle, disable offline work, click ok then.

How to disable gradle 'offline mode' in android studio? [duplicate]

This question already has answers here:
No cached version of gradle
(16 answers)
Closed 5 years ago.
I am new to android studio IDE development. Every time when I imported a sample project that developed in the android studio, I am getting this error..
No cached version of com.android.tools.build:gradle:1.1.0 available
for offline mode. Disable Gradle 'offline mode' and sync project.
How can I solve this problem.
New location in Android Studio 3.6+
View > Tool Windows > Gradle from the menu bar.
Then, near the top of the Gradle window, click Toggle Offline Mode Gradle offline button in the Gradle panel.
Old answer
On Windows:-
Go to File -> Settings.
And open the 'Build,Execution,Deployment'. Then open the
Build Tools -> Gradle
Then uncheck -> Offline work on the right.
Click the OK button.
Then Rebuild the Project.
On Mac OS:-
go to Android Studio -> Preferences, and the rest is the same.
OR follow steps given in the image
[
Edit. As noted in the comments, this is no longer working with the latest Android Studio releases.
The latest Android studio seems to only reference to "Offline mode" via the keymap, but toggling this does not seem to change anything anymore.
In Android Studio open the settings and search for offline it will find the Gradle category which contains Offline work. You can disable it there.
Gradle is in offline mode, which means that it won't go to the network to resolve dependencies.
Go to Preferences > Gradle and uncheck "Offline work".
#mikepenz has the right one.
You could just hit SHIFT+COMMAND+A (if you're using OSX and 1.4 android studio) and enter OFFLINE in the search box.
Then you'll see what mike have shown you.
Just deselect offline.
Offline mode could be set in Android Studio and in your project.
To verify that gradle won't build your project in offline mode:
Disable gradle offline mode in Android Studio gradle settings.
Verify that your project's gradle.settings won't contain: startParameter.offline=true

Categories

Resources