指定Android Studio编译工程时的源文件编码

统一设置为UTF8编码
在工程的根目录下的build.gradle文件中,添加定义。
tasks. withType(JavaCompile) {
    options.encoding = "UTF-8"
}

如图:

原文地址:https://www.cnblogs.com/glowworm/p/6907721.html