I\'ve always added dependencies like this:
dependencies {
compile \'com.android.support:mediarouter-v7:19.+\'
}
but in the recent versi
Avoid to use + in version declare.
You can try andle to check if dependency out of date, also the build tool version and sdk version.
Simple three step:
1. install:
$ sudo pip install andle
2. set sdk:
$ andle setsdk -p <sdk_path>
3. update depedency:
$ andle update -p <project_path> [--dryrun] [--remote]
--dryrun: only print result in console
--remote: check version in jcenter and mavenCentral
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.
Original Answer
the answer of ashoke is correct if you want the latest version.
But if you just want to replace "+" by the version you are currently using (therefor protection yourself against bug in future update)
eg:
compile 'com.android.support:appcompat-v7:21.0.+'
to
compile 'com.android.support:appcompat-v7:21.0.3'
(but not using 23.0.1)
this is the easiest way, no software needed:
run
$ ./gradlew clean tasks --debug > ~/whatever.txt
then look for "com.android.support:appcompat-v7:21.0."
a few line below you will see
"Using com.android.support:appcompat-v7:21.0.3 from Maven repository"
If it is a dependency that comes from Google's maven repository, the best way these days is to go to https://maven.google.com , where google now lets you browse all their libraries and see all the versions available, including the latest version. It looks like this:
You can even do a search for a specific library, and then expand/collapse it as desired:
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.
Recently I have found this,
Go to File -> Project Structure
Select the Module
, where you want to add the dependency.
Go to Dependencies
Tab
Click +
and Choose Library Dependency
Choose whichever Library you need from the list.
(There is also an option for Search, never tried though.)
Thats it.
Done.
Thank You.