READ THIS FIRST

Update: 3-4-2016: If you're finding this blog and looking for information related to Azure Mobile Services, I'd strongly recommend checking out Azure Mobile Apps. Azure Mobile Apps is a new version (consider it a v2) of Azure's mobile backend support. All of the same features of Azure Mobile Services are there, with a lot of other very cool features to go along. You can read more about Azure Mobile Apps, and how to transition from Azure Mobile Services, here.

I’ve been playing around with Android Studio a lot lately and wanted to try it out with the Windows Azure Mobile Services quickstart application.  Unfortunately, when I first imported the project, I ran into an issue with all of the source files.  The specific issue that Android Studio (and IntelliJ, and Ant, and anything that isn’t Eclipse) is reporting is illegal character \65279 at the beginning of each of the .java files.  The reason for this was fairly difficult to track down.  If you download the quick start application from GitHub, you won’t run into the issue.  If you download the Android SDK for Mobile Services and import that, you won’t see it either.  It turns out that the issue is the process that takes the quick start app in GitHub and merges it with your Mobile Service (i.e. sets the project name, the Mobile Service URL, the application key, etc).  For some reason, it’s changing the formatting so that an invalid character is at the start of each of the source files.  If you open any of the files inside of Android Studio (or Eclipse for that matter) you won’t actually see that invalid character at all:

Poor formatting not showing up

Here it looks like the first character is the “p” in package.  However, this isn’t the case.  If you open the file in notepad, you still won’t see anything out of the ordinary.  As of right now, the only program I’ve been able to successfully fix the issue in is nano.  If you open each of the source files in nano you’ll see there is an extra space at the beginning:

Badly formatted file

As you might guess, that isn’t really a space.  If you go in and delete that character and save the files, everything will build fine no matter what IDE you’re using.  This has been passed on to the team so hopefully we’ll get it fixed in the near future.

If you happen to find another editor (especially a Windows friendly one) that makes it easy to edit and fix the files, please let me know in the comments


Chris Risner