How to check what is the latest version of a dependency to use in gradle
As already mentioned by some other answers you should not use + in dependencies because it may lead to unpredictable builds, so its always better if you first test your builds once a new update is available.
With android studio 2.2 and above Project Structure will show you the latest dependencies available.
- Activate it by going to Android Studio > Settings > Build, Execution, Deployment > Gradle > Experimental and check the Use new Project Structure dialog
- Then open it by going to File >Project Structure > Messages
Original Answer
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:
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
Relying on latest version is indeed a dangerous thing to do. Your build can break without you changing anything, just because some library broke backwards compatibility.
The easiest way to know when new version of a library is out is to subscribe to new version notifications in Bintray.
Just click on the "Watch" button on the package page and you'll get an email every time new version is out. Then you'll be able to update the dependency, test it, and only then commit the build script with the new version.