Reputation: 822
I have two separated computers, the first having an internet access where the other one doesn't have. I used the one with internet access to install android studio build my android application where gradle caches all required dependencies. Then I managed to move the application along with the android studio and the .gradle
folder into the offline pc, then setting GRADLE_HOME
to the .gradle
directory. I'd also checked offline mode
in the android gradle setting of my project. But gradle still doesn't find its cached dependencies, saying:
Gradle sync failed: Could not download org.eclipse.jgit.jar ...: No cached version available for offline mode
Note that the above required dependency is already exist in the gradle cache.
Upvotes: 0
Views: 4441
Reputation: 822
It seams like gradle
maps its cached dependencies using their absolute path, so moving .gradle
directory into another pc will not work if the full path of the parent differs between the two computers. to solve the problem i managed to change the path of my gradle
home on the online pc into "C:\Program Files\android.gradle" by setting the environment variable GRADLE_USER_HOME to that path. Then started android studio and built my application to cache dependencies. After that i was able to successfully copy .gradle
folder from the online machine into the offline one by placing it in the same path as the online machine gradle
path and pointing to that path through the EV GRADLE_USER_HOME.
Upvotes: 1