How to add java compiler options when compiling with Android Gradle Plugin?

后端 未结 3 689
无人共我
无人共我 2020-12-16 11:58

I have a build.gradle file with dependencies { classpath \'com.android.tools.build:gradle:0.13.3\'} and apply plugin: \'com.android.applicati

3条回答
  •  执笔经年
    2020-12-16 12:27

    Add this to build.gradle file:

    android { // <---
       tasks.withType(JavaCompile) {
          configure(options) {
             options.encoding = 'UTF-8'
             options.debug = true
             options.failOnError = true
             options.warnings = true
             options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked'
       }
    }
    

提交回复
热议问题