在模块的build.gradle中加入:
tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
JavaCompile意思编译java代码时使用utf-8编码