java – Where does gradle save dependencies' jars?-ThrowExceptions

Exception or error:

I want to look at the jars/aars that are compiled when I add dependencies.

For example if I add this dependency in Gradle, where does it put the jar?

dependencies {
    compile 'com.google.android.gms:play-services-analytics:11.0.4'
}
How to solve:

Open your Android Studio Project Explorer, expand External Libraries sections. Right click and Show in Files/Explorer

###

Generally, you can find in:

%USERPROFILE%/.gradle/caches/modules-2/files-2.1

###

BY DEFAULT

Linux:

~/.gradle/caches/modules-2/files-2.1

Windows:

%USERPROFILE%/.gradle/caches/modules-2/files-2.1

Mac:

~/.gradle/caches/modules-2/files-2.1

Android:

no idea... can anyone edit?

SETTING TO SOMETHING ELSE

But you can override these default settings by setting GRADLE_USER_HOME. The latter environment variable, if set, is NOT the same as GRADLE_HOME, which is the path to the directory containing the bin/ directory for the Gradle version your system is using at the command prompt (NB instead of invoking Gradle directly at the command line most people seem to use the Gradle wrapper however: $ ./gradlew build).

RUNNING GRADLE IN AN IDE

IDEs may be using a different version and be storing dependency jars somewhere else. I only know Eclipse. Having installed Buildship (“Eclipse Plug-ins for Gradle”) the place to go is Window –> Preferences –> Gradle. There is a box here for you to specify “Gradle User Home”. Mine is currently empty. I presume it is using the system GRADLE_USER_HOME (which I have indeed set)… but I haven’t bothered checking: although it is possible to run Gradle tasks from within Eclipse to me it is more handy to run Gradle commands in a separate Terminal (*nix)/Command Prompt window (‘Doze).

Leave a Reply

Your email address will not be published. Required fields are marked *