通过配置Android studio 配置file encoding 无效,中文乱码,问题出现在java编译的时候jack采用了默认编码(中文windows默认的GBK编码)而乱码,所以不管更改build.gradle 中的哪种编码  

tasks.withType(JavaCompile) {
options.encoding = "utf-8"
}

以及 compileOptions.encoding="UTF-8"  均会乱码,原因如下:

Jack has been using the default VM encoding, which on windows is windows-1252.

 

解决办法:

找到项目根目录的gradle.properties文件,增加以下一行配置(若之前存在,则注释掉)

org.gradle.jvmargs=-Dfile.encoding=UTF-8

 

相关文章:

  • 2021-12-29
  • 2021-12-01
  • 2021-04-11
  • 2022-02-20
  • 2021-06-17
  • 2022-01-11
  • 2021-06-09
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2021-08-29
  • 2021-10-29
  • 2021-06-27
  • 2021-12-28
  • 2021-12-21
相关资源
相似解决方案