问题描述 在Androidstudio开发工具上允许java代码,控制台出现中文乱码,如下显示 解决方法 在java工程目录下的build.gradle添加如下代码,然后重新运行一遍。 1、新版gradle tasks.withType(JavaCompile) { options.encoding = "UTF-8" } 2、旧版gradle tasks.withType(Compile) { options.encoding = "UTF-8" } 如下图