Error(1,1)illegalcharacter '\ufeff' when compiling on android studio Error(1,1)illegalcharacter '\ufeff' when compiling on android studio android android

Error(1,1)illegalcharacter '\ufeff' when compiling on android studio


That's a problem related to BOM (Byte Order Mark) character. Byte Order MarkBOM is a Unicode character used for defining a text file byte order and comes in the start of the file. Eclipse doesn't allow this character at the start of your file, so you must delete it. For this purpose, use a rich text editor, such as Notepad++, and save the file with encoding "UTF-8 without BOM." That should remove the problem.


Android studio file encoding

On lower-right corner, you can set the file encoding. Select another option than UTF-8

If a popup appear, choose the option Convert.


As Marcelo told, I changed file Encoding option to UTF-16. Ran it, But didn't work. Again changed to UTF-8 and Converted it. It ran successfully. If above solution doesn't work, try this.