How to add -Xlint:unchecked to my Android Gradle based project?

前端 未结 7 905
囚心锁ツ
囚心锁ツ 2020-11-29 16:05

I tried to add the following to the root build.gradle file:

subprojects {
    gradle.projectsEvaluated {
        tasks.withType(Compile) {
              


        
7条回答
  •  我在风中等你
    2020-11-29 16:10

    Put this in your build.gradle file (root directory):

    allprojects { // Projects
       gradle.projectsEvaluated {
          tasks.withType(JavaCompile) {
             options.encoding = 'UTF-8'
             options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
          }
       }
    }
    

提交回复
热议问题