Follow this steps for create your first google glass app:




Setting Up Your Glass



The first thing you need to do is enable debug mode on your Glass. You have to do something like this on every Android device you use for development of your apps so this might be familiar. To enable debug, swipe to “Settings” -> “Device info” and then tap to open device menu. Select “Turn on debug” and it will be enabled.
In Android Studio, click “New Project” and fill in the project form. You can use something similar to this:

When selecting form factors and API make sure to select “Glass” and API 19


Select “Immersion Activity” as your startup activity.




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) or you can also select higher version if you want, Google USB Driver (under Extras) and click on Install Packages. This takes a while to download all the packages.

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.
[Google.NTamd64]
;GoogleGlass
%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
[Google.NTx86]
;GoogleGlass
%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 themeandroid:theme property. By removing this property, glass will apply it’s own theme.

4. Open strings.xml and add below string values.
strings.xml
xml version="1.0" encoding="utf-8"?>
<resources>
     
    <string name="app_name">Hello Glass</string>
    <string name="action_settings">Settings</string>
     
    
    <string name="hello_glass">Hello Glass !</string>
    <string name="home_url">www.androidhive.info</string>
     
    
    <string name="start_command">Hello Glass</string>   
</resources>


5. Now open your main activity layout file and paste the following code. In my case my activity layout isactivity_main.xml
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_centerInParent="true"
    android:gravity="center"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_glass" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/home_url"
        android:textSize="20dp" />
</LinearLayout>


6. you don't have to modified anything in MainActivity.java. Your main activity should look like below.
MainActivity.java
package info.androidhive.helloglass;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
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 toSettings ⇒ 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. your IDE 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.