Dheeraj Bhaskar
Dheeraj Bhaskar

Reputation: 19049

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?

Upvotes: 38

Views: 33504

Answers (4)

yoAlex5
yoAlex5

Reputation: 34461

Android Gradle Dependency library version

Android Studio 3.1.4

You are able to use Project view

enter image description here

Upvotes: 8

Dheeraj Bhaskar
Dheeraj Bhaskar

Reputation: 19049

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

Upvotes: 29

dmastra
dmastra

Reputation: 459

In Android Studio, in the build.graddle app, select the version and press ALT + ENTER, then select "Replace with specifyc version"

Upvotes: 2

Rene Groeschke
Rene Groeschke

Reputation: 28663

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

Upvotes: 34

Related Questions