How to check if gradle dependency has new version
In Android Studio when I use +
in version number (like com.android.support:recyclerview-v7:21.+
) I get "Avoid using + in version numbers" warning. When I use a specific version number I can't always use the latest version. I have a lot of dependencies in my project. How do I check if a dependency has a newer version? Is there an Android Studio plugin -or something like that- to notify me when there is a newer version of a dependency?
Edit: Android studio highlights the outdated android support libraries and Google play services. But this is not available for other custom libraries.
UPDATE (05/23/18):
The newer version of Android Studio does not show version updates in the Project Structure dialog. Instead, Adam-s answer is the correct one for Android Studio 3+
Analyze > "Run Inspection By Name"
Then search for "Newer Library Versions Available
"
PREVIOUS WAY:
As of Android Studio 2.2
, a new Project Structure
dialog shows the list of dependencies your app is using with the available updates from local AND remote repositories as well.
- Activate it by going to
Android Studio > Settings > Build, Execution, Deployment > Gradle > Experimental
and check theUse new Project Structure dialog
(Thanks @jessehensold) - Then open it by going to
File > Project Structure > Messages
For older version of Android Studio, see other responses below.
This is now built-in to Android Studio as a Lint check. You can enable it here:
Settings > Editor > Inspections > "Newer Library Versions Available"
The description for this inspection:
Newer Library Versions Available
This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project. This is similar to the GradleDependency check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.
Because of the slowdown this can introduce I'd recommend running it manually periodically, rather than having it always on. You can do this by:
Analyze > "Run Inspection By Name"
Then search for "Newer Library Versions Available", and run it on your module.
Edit: The above should just work as of Android Studio 2.3. If you're on an old version (you should update) the following may help:
Note that it appears you must have the inspection enabled in order to run it manually - so (as of Android Studio 2.0 Beta 2) you need to find the inspection in settings, enable it, then run it by name, then disable it again (to regain previous performance).