【问题标题】:Bypass AndroidX Migration error without disabling Lint在不禁用 Lint 的情况下绕过 AndroidX 迁移错误
【发布时间】:2020-03-10 10:03:01
【问题描述】:

现在 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)。

谢谢。

【问题讨论】:

    标签: android gradle migration androidx lint


    【解决方案1】:

    你可以像这样抑制这个错误:

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

    或者您可以将其添加到您的 build.gradle 文件中:

    android {
        lintOptions {
            abortOnError false
        }
    }
    

    【讨论】:

    • 谢谢@shmakova,我正在寻找第一个答案!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-29
    • 2019-03-24
    • 2021-01-08
    • 1970-01-01
    • 2020-12-29
    • 1970-01-01
    相关资源
    最近更新 更多