且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

棉绒:“可用较新的库版本”使用变量时

更新时间:2023-12-02 21:17:10

这不是该问题的确切答案。不久前,我也有同样的担忧(声明了全局变量,并从 build.gradle 文件中引用了它们)。



我找到了


I have a project with 3 sub-projects. I want the 3 sub-projects to use the same dependencies versions so I factored all the versions in the root build.gradle:

allprojects {
ext.versions = [
        supportLibVersion: '26.1.0',
        playServicesVersion: '11.2.2',
        retrofitVersion: '2.1.0',
        retrofitConverterGsonVersion: '2.1.0',
        retrofitRxjava2AdapterVersion: '1.0.0',
        rxjava2Version: '2.0.5',
        rxandroidVersion: '2.0.1',
        timberVersion: '4.5.1',
        ...
]
}

Now lint doesn't highlight new libraries available anymore. It somehow still works for the supportLibs but not for the other ones.

Any chance I can have this working again?

This is not an exact answer to the question. I had the same concerns some time ago (had declared global vars and referred to them from build.gradle files).

I've found gradle-versions-plugin library, which resolved my concerns.

It will prompt with detailed info after ./gradlew dependencyUpdates