Android Studio : unmappable character for encoding UTF-8
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) convert file encoding to UTF-8 or
b) set the right file encoding in your build.gradle script:
android {
...
compileOptions.encoding = 'windows-1251' // write your encoding here
...
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.
Also read this Use the UTF-8, Luke! File Encodings in IntelliJ IDEA
Adding the following to build.gradle solves the problem :
android {
...
compileOptions.encoding = 'ISO-8859-1'
}
1/ Convert the file encoding
File -> Settings -> Editor -> File encodings -> set UTF-8 for
- IDE Encoding
- Project Encoding
- Default encoding propertie file
Press OK
2/ Rebuild Project
Build -> Rebuild project
I have the problem with encoding in javadoc generated by intellij idea. The solution is to add
-encoding UTF-8 -docencoding utf-8 -charset utf-8
into command line arguments!
UPDATE: more information about compilation Javadoc in Intellij IDEA see in my post