Reputation: 4827
I am trying to compile project via command line without internet connection. I never ran the project assembleRelease via cmd before so I do not have cached version of the gradle and hence I receive the error:
No cached version of com.android.tools.build:gradle3.0.1: available for offline mode
What I assume I need to do is (go where no one has gone before) copy cashed version of the gradle from android studio (in there assembleRelease runs just fine). But I got confused in within those folders. I have gradle folder in AndroidStudio folder with m2repository and gradle-4.1 Then also folder in C:\Users\ACAndroid.gradle with caches folder and other folders. The last folder is .gradle in my project with 4.1 folder, wrapper and etc.
So what is the correlation between these 3 gradle folders and what I need to copy where in order to run the project via cmd. Also when running in --offline --debug I can see it searches the ACAndroid folder.
Upvotes: 1
Views: 120
Reputation:
Here's what you need to do: (On windows: if you don't have the Gradle version cached yet)
sysdm.cpl
by pressing Windows + RNow click on the Advanced tab and then click on the Environment Variables button:
Now click on Path under System Variables (to access globally) or user (to only make it available on your user account)
If you already have it cached, then it should be somewhere here (unless you have determined to save gradle to a different location):
%USERPROFILE%\.gradle\wrapper\dists\gradle-x.x-all\
Now simply add this to path, and now you've made this accessible globally. But be sure to only add the bin directory as only then will you be able to access the binary executable! Adding applications to the path makes life way simpler!
For more information with adding environment variables, see this: https://www.java.com/en/download/help/path.xml (It's a similar scenario like yours)
Upvotes: 1