Thursday, September 24, 2020

How to solve the issues No cached version available for offline mode in Gradle.

By Default Gradle take the path c:\user\.gradle

but when you shared this .gradle folder to other user it will not be helpful to build the project in offline mode as it will give you
No cached version available for offline mode in Gradle

To over come this make sure to have your .gradle folder to be created our side your USER foler i.e. outside its default location c:\user\\

Let say If i want to share my .gradle folder to other machine that not connected to internet in that case  first build your project using internet for gradle and choose any folder other than default c:\user\
In my below example i am choosing gradle_home from my C folder to have .gradle folder

C:\siddhu\gradle_home

Once this is done share your gradle_home folder to the user not having internet and ask them to store the same in the package

i.e. c:\siddhu\gradle_home and click on offline check box to execute the build using offline mode.

Note:

You can also use the GRADLE_USER_HOME parameter to set on the Command prompt and run the gradle build --offline to build the project
Set GRADLE_USER_HOME=C:\siddhu\gradle_home\

No comments: