用android studio来写代码,在代码中加了中文注释导致无法编译:提示错误:“Gradle: 警告:编码 GBK 的不可映射字符”。
编译出错,在项目下的build.gradle下添加以下代码即可解决。
tasks.withType(Compile) {
options.encoding = "UTF-8"
}
编译出错,在项目下的build.gradle下添加以下代码即可解决。
tasks.withType(Compile) {
options.encoding = "UTF-8"
}