android - 绕过AndroidX迁移错误而不禁用Lint

标签 android gradle migration androidx lint

现在,Android迫使开发人员迁移到AndroidX,所以我遇到了这个 Lint 错误。

Caused by: org.gradle.api.GradleException: Lint found errors in the project; aborting build.

Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
    lintOptions {
        abortOnError false
    }
}
...

build.gradle:31: Error: so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX... [GradleCompatible]
        implementation 'com.android.support:design:28.0.0'

因此,我想绕过此检查而不进行其他错误处理。

我知道我可以使用lint禁用特定规则,但是找不到可以克服此问题(迁移到AndroidX)的规则。

谢谢。

最佳答案

您可以像这样抑制此错误:

//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'

或者,您可以将其添加到build.gradle文件中:
android {
    lintOptions {
        abortOnError false
    }
}

关于android - 绕过AndroidX迁移错误而不禁用Lint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60615293/

相关文章:

android - VFY : unable to find class referenced in signature

android - AchartEngine Bar Graph Android 中Repaint 的使用方法

java - Gradle 找到 Servlet 库,但找不到 JSP,即 javax.servlet.jsp.tagext。如何导入?

asp.net - 网站从目标框架 3.5 迁移到 4.5

Android 应用程序链接无法正常工作

Android Studio 获取 "Must implement OnFragmentInteractionListener"

sorting - 如何在任务中对源文件进行排序?

gradle - Gradle项目的Circle CI缓存

ruby-on-rails-3 - Rails 迁移 : add same column to multiple tables

ruby-on-rails - Heroku 迁移 : type modifier is not allowed for type "bytea"