如果 Gradle 覆盖传递依赖项,我可以忽略 "Incompatible Gradle Versions" lint 检查吗?

Can I ignore "Incompatible Gradle Versions" lint check if Gradle overrides transtivie dependencies?

我刚刚违反了这个 lint 检查:

Incompatible Gradle Versions ../../build.gradle: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 25.2.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:support-v13:25.2.0

我的一些传递依赖肯定没有更新到最新的支持版本。但是,我将支持库设置为一级依赖项,在我的应用程序 build.gradle 文件的最新版本中。我什至可以看到 Gradle 覆盖了所有这些依赖项:

$ ./gradlew app:dependencies | grep 25.2.0

|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    +--- com.android.support:support-v13:25.2.0
|    |    +--- com.android.support:support-annotations:25.2.0 -> 25.3.1
|    |    \--- com.android.support:support-v4:25.2.0 -> 25.3.1 (*)
|    \--- com.android.support:design:25.2.0 -> 25.3.1 (*)

有什么我需要担心的,或者我可以安全地忽略这个 lint 错误吗?

它没有覆盖所有依赖项:com.android.support:support-v13:25.2.0 没有更新为 25.3.1

您应该添加 compile "com.android.support:support-v13:25.3.1" 以确保所有内容都在同一版本上。

您将需要获取新的 gradle 版本。即使它覆盖了它,它也不会起作用。我最近发布了一个 android 应用程序,必须获得一个新的 gradle 版本。你可以在这里下载https://gradle.org/releases