I got an Eclipse project source code(I was told that on Android Studio, maybe they just confused), and I start to migrating the code to android studio refers to
Just delete the first line of the xml-file and retype it by hand (copy paste would reinsert the hidden BOM).
The ideas in here certainly helped me but the outcome was a little different.
I did convert my file encoding from UTF-8 to UTF-16. I was then presented with a different error. When i converted it back to UTF-8, I noted that there was a string of unrecognizable characters before my code line. I removed them and recompiled and it worked well.
My conclusion is somehow an unrecognizable character snuck into my code. Could be programmer error, or a blind copy/paste from the web that placed a nasty hidden character. Carrying the process above as outlined by our peers here somehow allowed me to see it.
If you'll follow this idea above, please make sure to clean/rebuild between each conversion.
i solved this problem with this method :
This method work for me. tnx
I try using sublime, open the file then "Save with Encoding" there choose UTF-8 (without BOM), and it works :)
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.
Simply go in notepad plus plus and open your file and in encoding option at the top bar just select utf8