Andrejs
Andrejs

Reputation: 27707

How does Android Studio know about new dependency versions?

Android Studio seems to know when there's a newer version of a dependency. Maven repositories have all the versions so of course it can check there but it doesn't do it for all dependencies.

Noticed that it works for com.google and com.android dependencies but not for others. Why is that? Can it be configured? Any insight on this is appreciated.

enter image description here

Upvotes: 10

Views: 410

Answers (3)

HotIceCream
HotIceCream

Reputation: 2309

In Android Studio this check is path of Lint checks. You can see it here:

https://android.googlesource.com/platform/tools/base/+/master/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/GradleDetector.java

And deps are hardcoded in this file:

    } else if ("com.google.guava".equals(dependency.getGroupId()) &&
            "guava".equals(dependency.getArtifactId())) {
        version = getNewerRevision(dependency, new PreciseRevision(18, 0));

Upvotes: 2

HotIceCream
HotIceCream

Reputation: 2309

If you wish to check all deps, you can use this plugin https://github.com/ben-manes/gradle-versions-plugin

Add to your build.gradle call:

apply plugin: 'com.github.ben-manes.versions'

And then execute task:

./gradlew dependencyUpdates

Upvotes: 0

Nishad
Nishad

Reputation: 1311

Gradle does it for you. Notice that the suggested versions depend on the gradle version. If you are using an outdated gradle version you won't get these suggestions.

Upvotes: 0

Related Questions