Gradle 警告:您似乎在尝试替换版本变量,但使用的是单引号 (')。尝试使用快速适配器库

Gradle warning : It looks like you are trying to substitute a version variable, but using single quotes ('). Trying to use Fast Adapter Library

美好的一天,我正在尝试在我的项目中使用快速适配器库。我从 link https://github.com/mikepenz/FastAdapter. The synchronization of my project successfully built but I got this warning (captured link) 中阅读了安装指南,上面写着

"It looks like you are trying to substitute a version variable, but using single quotes (')."

implementation 'com.android.support:appcompat-v7:${latestSupportLib}'

虽然项目构建成功了,但是在实现的库下看到红线还是很烦。可以忽略该警告吗?或者有什么方法可以修复该警告吗?

你应该更换

implementation 'com.android.support:appcompat-v7:${latestSupportLib}'

implementation "com.android.support:appcompat-v7:${latestSupportLib}"

implementation 'com.android.support:appcompat-v7:27.1.1'

(其中 27.1.1 是 Android 支持库的 current latest stable version)。

参见http://docs.groovy-lang.org/latest/html/documentation/#_string_interpolation(我强调的):

Any Groovy expression can be interpolated in all string literals, apart from single and triple single quoted strings.

(项目目前正在构建的事实让我很惊讶!)