Android的工作室:编码UTF-8的不可映射的字符字符、工作室、Android、UTF

2023-09-12 07:03:56 作者:拽↘爷霸气↗

导入我的项目,从偏食到Android的工作室后,我已经得到了以下错误:

After importing my project from eclipse into android studio i have got the following error :

Error: unmappable character for encoding UTF-8

Android的工作室:0.5.8

推荐答案

我有同样的问题,因为有与Windows-1251编码和西里尔意见的文件。在Android的工作室,是基于IntelliJ IDEA的,你可以解决它在两个方面:

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:

)转换文件编码成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的右下角。首先选择正确的文件编码 - > preSS的刷新的 - >选择UTF-8 - > preSS的转换的

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.

另外阅读Use在UTF-8,卢克!在IntelliJ IDEA的文件编码