Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the version of library from Gradle Dependency? Android Studio

Question:

How do I find the version of libraries that are being used when my Gradle file mentions a dependency using the '+' operator in the version number of the dependency?

Context

My build.gradle under app module reads like so:

dependencies {   compile fileTree(dir: 'libs', include: ['*.jar'])   compile 'com.google.android.gms:play-services:5.+' } 

What is the version of the play-services library that is being used here?

like image 928
Dheeraj Bhaskar Avatar asked Aug 10 '14 22:08

Dheeraj Bhaskar


People also ask

How do I know if Gradle dependency has new version?

Go to Android Studio -> Preferences -> Plugins (for Mac) and File -> Settings -> Plugins (for windows) and search “Check for Dependency updates plugin”. Install it and restart android studio. You will be able to see Dependencies tab on the right which will show if any dependency has a new update available.

How does Gradle determine version?

In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here. If you are using the Gradle wrapper, then your project will have a gradle/wrapper/gradle-wrapper.

How do you read a Gradle dependency tree?

In Gradle dependencies are libraries required to build your code. Each of these libraries may have their own dependencies, adding transitive dependencies to your project. This structure is called the Gradle dependency tree, with its own rules on dependency conflict resolution and more.


2 Answers

You can use gradles' build-in 'dependencyInsight' task to query the resolved version of your dependency:

gradle dependencyInsight --configuration compile --dependency com.google.android.gms:play-services 

If you want to get an overview for all your dependencies in one go, you can do

gradle dependencies 

If you use the gradle wrapper you must use ./gradlew instead of gradle

like image 107
Rene Groeschke Avatar answered Oct 17 '22 17:10

Rene Groeschke


Look under .idea folder of your project

In the Project Pane on the left, browse to .idea/libraries

All the library dependencies that your project has have been mentioned, with each one getting its own xml file. You can see the version number included in the xml file title. The xml itself has the library file path.

snapshot of .idea/libraries

(OR) Use Gradle's built in task to get dependencies

See steps here: https://stackoverflow.com/a/25236208/1311745

like image 41
Dheeraj Bhaskar Avatar answered Oct 17 '22 16:10

Dheeraj Bhaskar