8

How to find latest version number of google specific libraries from repositories (jcenter etc..) to include in gradle dependencies in Android Studio.

For non google libraries generally I can make a search in jcenter itself. But not able to search google specific libraries there.

You may take example of following libraries.

com.android.support:appcompat-v7:25.1.0'
com.android.support:recyclerview-v7:23.3.0' 
  • 2
    Gradle tells you by highlighting them as a warning – Tim Jan 12 '17 at 10:29
  • 1
    `ANDROID_SDK\extras` then `android\m2repository` (for support libs) and `google\m2repository` (for google and firebase)... fx for play service it would be `ANDROID_SDK\extras\google\m2repository\com\google\android\gms\play-services` ... form me newest is 10.0.1 – Selvin Jan 12 '17 at 10:36
  • All these answers are hacky at best! There really should be a simple and guaranteed way to make this work. It's pretty important after all! – SMBiggs Apr 26 '19 at 17:55
  • @Selvin Thanks, this lets us choose earlier versions of libraries too, in case of compatibility issues with the latest versions. If you write this as an answer, I'll vote for it. – auspicious99 Apr 11 '20 at 03:06
  • @Selvin Hmm.. I just noticed that the numbering in the maven repositories is different from the numbering we need to use in android studio? Latest version in maven are 10.x.y and 11.x.y but in android studio 16.x.y and 17.x.y ? (for play services) – auspicious99 Apr 11 '20 at 03:17
  • The numbering of the libraries that Android Studio uses, can be found all listed at maven.google.com, as I just wrote in my answer below. – auspicious99 Apr 11 '20 at 09:11
  • @auspicious99 are you thread necromancer? maven.google.com didn't exist in january 2017 – Selvin Apr 11 '20 at 16:36

4 Answers4

9

Yes as Tim mentioned in the comment Gradle tells you by highlighting particular dependency as a warning.

Trick to update dependency with latest version:

Let me also share a trick through which you can always include the latest version of the particular dependency.

  1. Replace the version number with only "+" sign.
  2. Sync gradle
  3. Now select + sign and press ALT + ENTER, it will show you drop down menu with an option to select latest version.

enter image description here

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • Your solution sounds good in theory, but in practice hitting `ALT` + `ENTER` results in the program insisting that I type in a number (instead of filling in a number which it usually does). And that's the number I'm trying to find! – SMBiggs Apr 26 '19 at 17:54
1

If you have added a dependency, you can see them by moving the cursor to that library. It will show you a warning

like this

You can then change to new library and sync your project.

Rakesh Yadav
  • 1,966
  • 2
  • 21
  • 35
  • I've noticed that recently I'm no longer getting these warnings to update. They still highlight that the sdk version could be updated, but nothing in the dependencies section. – Flyview Oct 27 '17 at 22:22
  • 1
    @Flyview I am using Android Studio 3.0 which was released 3 days ago and it's still working the same way. – Rakesh Yadav Oct 28 '17 at 10:25
  • @RakeshYadav I just got the notification to update to 3.0 (from 2.3.3) and it is working again! – Flyview Oct 28 '17 at 14:12
  • I don't know what was the issue. But it was working for me in 2.3.3 version as well. Whatever was the reason, happy to know that it helped you. – Rakesh Yadav Oct 30 '17 at 06:24
1

Another way to use the latest libraries in Android Studio.

Right click your project and choose Open Module Settings. Project Structure window will appear. Select 'app' from the left pane and choose the 'Dependencies' tab. Include new library dependency by pressing the + icon. Search your needed library in the window opened up. Latest library dependency will appear in the suggestions and you can add them to your project.

Febi M Felix
  • 2,799
  • 1
  • 10
  • 13
1

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:

enter image description here

You can even do a search for a specific library, and then expand/collapse as desired:

enter image description here

auspicious99
  • 3,902
  • 1
  • 44
  • 58