1

I'm new to Android Studio. I imported a working project into Android Studio from Eclipse. When I build it the message "error: illegal character: '\ufeff'" appears. This project has been compiling just fine in Eclipse for months and the app runs 100% successfully on my device.

Elsewhere in Stack Overflow I'd read that perhaps an unreadable character got added inadvertently to the java file. Since I use Windows I tried copying and pasting the problematic class to Notepad and then back to Android Studio. But that had no effect.

Is there any other solution to this frustrating problem? Thanks!

PeteH
  • 1,870
  • 25
  • 23
  • That is a Byte Order Mark (BOM). It has to do with the selected string encoding. This answer has some possible solutions https://stackoverflow.com/questions/17151830/android-studio-writing-boms-to-utf-8-file or here https://stackoverflow.com/questions/5406172/utf-8-without-bom – Tyler V Jul 17 '18 at 02:30

4 Answers4

4

In AndroidStudio, right click in your class, select "Remove Bom" in the menu

2

Try, File \ File Properties \ Remove BOM

This works for me perfectly fine in android studio dolphin.

1

In eclipse, Window > Preferences > write "encoding" in search box > change settings as a default or UTF-8

Your error generally comes with UTF-8-BOM

You can try this

0

I solved the problem by copying my code onto a text editor, Notepad++ on Windows. I then deleted the file in Android Studio, recreated it in Android Studio and added back my code by copying it from the text editor.