Android Studio:用于编码 UTF-8 的不可映射字符 [英] Android Studio : unmappable character for encoding UTF-8
问题描述
将我的项目从 Eclipse 导入 android studio 后,出现以下错误:
After importing my project from eclipse into android studio i have got the following error :
Error: unmappable character for encoding UTF-8
Android Studio:0.5.8
推荐答案
我遇到了同样的问题,因为有些文件带有 windows-1251 编码和西里尔文注释.在基于 IntelliJ IDEA 的 Android Studio 中,您可以通过两种方式解决:
I had the same problem because there was files with windows-1251 encoding and Cyrillic comments. In Android Studio which is based on IntelliJ IDEA you can solve it in two ways:
a) 将文件编码转换为 UTF-8 或
a) convert file encoding to UTF-8 or
b) 在 build.gradle 脚本中设置正确的文件编码:
b) set the right file encoding in your build.gradle script:
android {
...
compileOptions.encoding = 'windows-1251' // write your encoding here
...
要转换文件编码,请使用 IDE 右下角的菜单.首先选择正确的文件编码 -> 按 Reload -> 选择 UTF-8 -> 按 Convert.
To convert file encoding use the menu at the bottom right corner of IDE. Select right file encoding first -> press Reload -> select UTF-8 -> press Convert.
另请阅读此使用UTF-8,卢克!IntelliJ IDEA 中的文件编码
这篇关于Android Studio:用于编码 UTF-8 的不可映射字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!