Getting started with Google Glass Development

Today I am very excited to write my first Google Glass tutorial. This is the first article on android wearable devices which is a simple Hello World app. Going forward I’ll cover other android wearables like watches.

I know that Google Glass is very expensive and not everybody afford to have one. But I am sure the price will comedown once the glass is stable and more popular.

As of today there is no official glass emulator to test the apps. But you can try out these options discussed in this forum.

If you are really serious about building apps for glass, you can order it from PlayStore.

google glass hello world program

The following steps will take you through various stages of glass development like downloading GDK, installing drivers, writing a simple hello world program and deploying the same on glass.

1. Downloading GDK (Glass Development Kit)

Glass Development Kit provides APIs to build glassware applications. These APIs won’t be available in all the versions of android.

1 Open SDK manager from your android’s SDK folder.

2 Select Android 4.2.2 (API 19), Google USB Driver (under Extras) and click on Install Packages. This takes a while to download all the packages.

android installing google glass gdk

2. Installing Google Glass Drivers

Android device drivers can be installed either from android SDK’s google usb drivers or with the software that comes from device manufacturer. For Google Glass we can directly use google usb driver. But before installing we need to do a modification in android_winusb.inf, otherwise, your glass device won’t be listed in Eclipse even though you have installed the drivers correctly.

1. Goto your android_SDK_folder\sdk\extras\google\usb_driver and edit android_winusb.inf. Add the below text at the end of the file.


%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11&REV_0216
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E11&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_9001&REV_0216
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_9001&MI_01


%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11&REV_0216
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E11&MI_01
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_9001&REV_0216
%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_9001&MI_01

2. Now open Run (shortcut Win + R) and type devmgmt.msc and press ok. This opens up Device Manager window.

3. In device manager right click on your Google Glass device and click install drivers. When it ask for browse location, select android_winusb.inf parent folder and follow the instructions.

Following links will help you if you got into any issue.
Google USB Driver
Installing USB Driver
Stackoverflow Discussion

3. Creating new Glass Project

Creating a glass project is same as usual android project, but it differs in choosing proper API version.

1. Create a new project in Eclipse. File ⇒ New ⇒ Android Application Project and give application name, project name and package.

2. Set Minimum Required SDK and Target SDK to API 19: Android 4.4 (KitKat), Compile With to Glass Development Kit Sneak Peek (Google Inc.) (API19) and select the Theme to None

3. Once the project is created open AndroidManifest.xml file and remove the theme android:theme property. By removing this property, glass will apply it’s own theme.

4. Open strings.xml and add below string values.

<?xml version="1.0" encoding="utf-8"?>
    <string name="app_name">Hello Glass</string>
    <string name="action_settings">Settings</string>
    <!-- main activity strings -->
    <string name="hello_glass">Hello Glass !</string>
    <string name="home_url"></string>
    <!-- "ok glass" voice command -->
    <string name="start_command">Hello Glass</string>    


5. Now open your main activity layout file and paste the following code. In my case my activity layout is activity_main.xml

<LinearLayout xmlns:android=""
    android:orientation="vertical" >

        android:text="@string/hello_glass" />

        android:textSize="20dp" />


6. I haven’t modified anything in Your main activity should look like below.

package info.androidhive.helloglass;

import android.os.Bundle;

public class MainActivity extends Activity {

	protected void onCreate(Bundle savedInstanceState) {

Until now we are done with simple hello world program. In the next step we’ll learn how to deploy the app on the glass device.

4. Running the application on Glass

7. In order to deploy the app on Glass we need to turn on debug option. So on your glass go to Settings ⇒ Device Info ⇒ Turn on debug.

8. Now connect the Glass to your PC using a USB cable. Right click on the project and Run As ⇒ Android Application. Eclipse will list the glass in the list of devices available. Select the glass device and press ok. You should able see the app running on your glass.

google glass hello world program

Now you have successfully developed your first Hello Glass application. But if you close the app or glass goes to sleep, you can’t find the app again anywhere on glass.

In the next step we’ll learn how to add our app to “Ok Glass” menu. So that we can launch our app using a voice command like other glass apps.

5. Adding our app to “Ok Glass” menu

9. Download app_icon.png and paste it in res ⇒ drawable folder. As per glass guidelines, app icon should be 50x50px with white foreground and transparent background.

10. Create a new folder named xml under res folder.

11. Inside res ⇒ xml folder create an xml file named voice_trigger_start.xml.

<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/start_command" />

12. Now add DEVELOPMENT permission in the AndroidManifest.xml which allows us to use unlisted glass voice commands.

Also we need to modify the intent-filter and a meta-data tag for the main activity by adding VOICE_TRIGGER properties.

<uses-permission android:name="" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

        android:targetSdkVersion="15" />

    <uses-permission android:name="" />

        android:label="@string/app_name" >
            android:label="@string/app_name" >
                <action android:name="" />

                android:resource="@xml/voice_trigger_start" />


Now deploy the app once again on the glass. This time app won’t be launched automatically. You have to launch the app by saying Ok Glass Hello Glass command.