![](/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.