Building Google Glass projects in Android Studio  

Time to read: 2 min | 13 July, 2014 | Will Ellis

Recently Google Glass came to the UK and I'm lucky enough to work for a company who have purchased a pair. I found them slightly odd at first but they are definitely interesting and I've gone ahead and started to try and develop some Glassware (what Google are calling the apps that run on Glass.)

Google have kindly supplied some sample projects which you can find links to over at the Glass Developer website: https://developers.google.com/glass/samples/index

The guides they supply to set up the samples sadly use Eclipse rather than the far superior (in my opinion anyway!) Android Studio. I had a couple of problems setting up the samples to build for Glass so thought I would share how to get it done if anyone else out there is stuck.

First things first and you have probably already done this, but make sure you have downloaded the SDK Platform and the Glass Development Kit Preview. Right now the most recent of this is API 19, although depending on when you read this there may be a later version.

SDK Manager

Once they are downloaded you can open up the sample project you've downloaded, I downloaded the Stopwatch live card example. If you already had Android Studio open then go ahead and restart it to ensure that it will pick up the SDK you just downloaded.

The project showed up with a lot of errors for me, and this was because Android Studio needs you to set the SDK you are using, opening up File --> Project Structure you'll see under the SDK section a whole bunch of android SDKs you have installed, sadly Android Studio doesn't show us the Glass Development kit SDK though, so you need to manually add that.

Project Structure

Click the 'Add New SDK' button at the top of the project structure window and select 'Android SDK'. Android Studio will want you to point it at your SDK folder, mine for instance is currently at 'C:\Users\Will\AppData\Local\Android\android-studio1\sdk' but yours will obviously be different.

Once you hit OK you should be able to select the Glass Development Kit Preview from the build target drop down, hit OK on that and you will now have access to the Glass SDK for your project.

Add SDK

Still in the project structure window, select 'Project' at the top and from the Project SDK dropdown you will now be able to select 'Android 4.4.2 Glass Development Kit Preview' for the sample project.

Project Setup

You may now be able to build the sample project, but I also found that I needed to make another change in the project structure. Go to the 'Modules' section in the project structure and make sure you have the module SDK set to 'Android 4.4.2 Glass Development Kit Preview'.

Project Structure Modules

Hopefully now when you build the sample project it will succeed.  If not please post a comment if you need any help.

Have fun making some Glassware!