Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check what is the latest version of a dependency to use in gradle

I've always added dependencies like this:

dependencies {     compile 'com.android.support:mediarouter-v7:19.+' } 

but in the recent versions of Android Studio, they recommend not to use the + as it can lead to errors. How to know what's the latest version? I can try every combination of 19.y.x until gradle complains, but what's the real way do check?

edit: sometimes, that page helps me figure it out.

like image 997
mbmc Avatar asked Sep 25 '14 00:09

mbmc


People also ask

How do I get the latest version of dependency in Gradle?

You can use the version string “latest. integration” to achieve this. This is a dynamic version that tells Gradle to use the very latest version of a dependency. Note that for a maven repository, this feature requires that the list of all available versions is published in a maven-metadata.

What is Gradle latest version?

0 (May 2022) Android Gradle plugin 7.2. 0 is a major release that includes a variety of new features and improvements.

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.


1 Answers

There may be other ways, but here is what i use:

You can find out the latest version using Android Studio by replacing the version number of your library in build.gradle compile line, with just + , and click on Sync Now in upper right corner of the window.

in your case, for example

dependencies { compile 'com.android.support:mediarouter-v7:+' }

Android Studio will pop up a hint/bulb, which has options Replace with specific version you can click, which will fill-in the latest version in-place of +. Please see below screeshot:

android studio hint

If this doesn't work the first time, let gradle complete its sync, and retry (replace + with + or any file modification will do, click the sync now again and hint bulb will show up).

For example, for your library, i simply pasted this line compile 'com.android.support:mediarouter-v7:+' under my dependencies and followed the above process, Android Studio filled in with below version

.

like image 104
ashoke Avatar answered Sep 21 '22 08:09

ashoke