Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 898
Andrejs Avatar asked Jul 19 '15 14:07

Andrejs


People also ask

How do I know if Gradle dependency has new version?

Go to Android Studio -> Preferences -> Plugins (for Mac) and File -> Settings -> Plugins (for windows) and search “Check for Dependency updates plugin”. Install it and restart android studio. You will be able to see Dependencies tab on the right which will show if any dependency has a new update available.

Where are dependencies stored Android Studio?

The Gradle build system in Android Studio makes it easy to include external binaries or other library modules to your build as dependencies. The dependencies can be located on your machine or in a remote repository, and any transitive dependencies they declare are automatically included as well.

Why dependencies are used in Android Studio?

In Android Studio, dependencies allows us to include external library or local jar files or other library modules in our Android project.

Where are module dependencies declared in an Android project?

To use your new Android library's code in another app or library module within the same project, add a project-level dependency: Navigate to File > Project Structure > Dependencies. Select the Module in which you'll use the library. In the Declared Dependencies tab, click and select Module Dependency in the dropdown.


1 Answers

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));
like image 50
HotIceCream Avatar answered Oct 21 '22 11:10

HotIceCream