如果使用了Gradle管理項目 打開項目的build.gradle文件,向其中加入下列代碼 tasks.withType(JavaCompile){ options.encoding="UTF-8" } 下次編譯將會使用指定的編碼編譯