![](/img/trans.png)
[英]testCompile results in Android studio not resolving dependencies
[英]Android lint: How to disable “NewerVersionAvailable” check for testCompile dependencies?
我正在使用NewerVersionAvailable
lint 检查来确定较新的依赖项版本。 但看起来这个检查只对implementation
依赖有用。 我认为我们不需要很快更新junit
。 如何禁用对单独依赖类型的检查? 为每个testImplementation
依赖添加//noinspection
很无聊。 给出的例子:
dependencies {
// should warn
implementation 'com.android.support:support-annotations:25.0.0'
// shouldn't warn
testImplementation 'junit:junit:4.12'
}
最好禁用对单个依赖项的检查,因为这样仍然会收到任何进一步过时的库的通知:
<issue id="NewerVersionAvailable">
<ignore regexp="junit:junit*"/>
</issue>
使用这样的模式: junit:junit*
可以忽略单个依赖项 - 并且可以使用这样的模式忽略整个依赖项组: junit:*
。
这仍然需要结合//noinspection GradleDependency
,因为lint
和 IDE 的代码检查不是一回事。
您可以在您的项目中为 lint 创建一个配置文件,并将这一行添加到其中,如下所示:
<lint>
...
<issue id="NewerVersionAvailable" severity="ignore" />
...
</lint>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.