Run lint when building android studio projects

前端 未结 7 764
予麋鹿
予麋鹿 2020-11-28 07:12

I would like to be able to run the lint task when I\'m building projects with the android studio to ensure the lint rules are being followed.

I have tried using task

7条回答
  •  盖世英雄少女心
    2020-11-28 08:02

    Just modifying answer of @Yoel Gluschnaider

    For me if I use Val it shows error like this : Could not set unknown property 'lintTask' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.

    So I replace it

    applicationVariants.all {
        def lintTask = tasks["lint${name.capitalize()}"]
        assembleProvider.get().dependsOn.add(lintTask)
    }
    

    and it work fine!!

提交回复
热议问题