Develop apps for Google Glass – Part 3 – Setting up!

Developing apps for Google Glass by Marcio Valenzuela
Developing apps for Google Glass

If you have experience in Android (Java) development, this will be even easier.

What you’ll need:

  1. Google Glass – to test your apps on
  2. Eclipse or Android Studio for coding
  3. Android SDK 15 & Glass Development Kit Sneak Peek (GDK)
  4. Configure adb

Glass

Well you either borrow a pair or get your own, but you will need Google Glass to test your apps.  The reason being that there is no Glass emulator as there is for Android as of yet.

Eclipse or Android Studio

Eclipse is the most widely known IDE for Android programming but its worth getting to know Android Studio, the new IDE for developing on Android & Glass. You can get it here:

http://developer.android.com/sdk/installing/studio.html

This is version 0.4.2 but there is a new build, 0.4.3 (Canary) to date of this publication.

Its ok if you choose Eclipse, the differences are minimal in general usage terms.

Android SDK 15 & GDK

If you’re used to iOS, where the IDE (Xcode) already includes the SDK, you’re in for a treat. In this case its necessary to manually get the SDKs; both API 15 as well as GDK. To do this you use the Tools menu & select AVD Manager:

Android Studio SDK Manager Glass GDK Sneak Peek by Marcio Valenzuela Santiapps.com
Android Studio SDK Manager Glass GDK Sneak Peek

Now you must pick the right SDKs. I recommend getting these options:

Android Studio SDK Manager Glass GDK Sneak Peek by Marcio Valenzuela Santiapps.com
Android Studio SDK Manager Glass GDK Sneak Peek

To install you must then click on Install Packages and individually Accept each license. This will take a while for the SDKs to download.

ADB

Now you’re ready to start programming, sorta.  You need the Android Debug Bridge, ADB.  This allows us to connect to Android/Glass devices and debug directly on them.  Again, if you’re coming in from an iOS environment you test on the iPhone Simulator and thats good enough to get started.  However, on Android, BELIEVE me, you DO NOT want to test on the emulator.  Both Eclipse and AS bring the AVD Manager, Android Virtual Device Manager which creates emulators in many configurations.  Just launching these can sometimes waste up to 15 minutes of your precious time.  This means that in a day of coding you can literally waste HOURS just waiting for the emulator to fire up.

Besides, as we mentioned, you can’t test Glass apps on anything but Glass devices.  So this is necessary.

Fortunately if you installed Android Studio, adb is already in Android Studio.app/sdk/platform-tools. If you’re on a mac you will need to add this path as an environment variable.  You might even need to create a symbolic link.  This is due to the fact that Android Studio is contained in one of these peculiar .app folders.  As you will see later, its hard to configure some neat development tools if you have files you need to get at, stored inside one of these .app packages.  You can inspect the application package in Finder:

Android Studio Package Contents Environment Variables Symbolic Links ADB Configuration by Marcio Valenzuela Santiapps.com
Android Studio Package Contents Environment Variables Symbolic Links ADB Configuration

In order to add an environment variable we first need to edit our ~/.bash_profile from terminal by doing this:

pico ~/.bash_profile

Now add the following line inside pico:

export PATH=/Applications/Android\ Studio.app/sdk/platform-tools:$PATH

this is assuming you installed Android Studio inside your Applications folder.

Now dab is accesible from any terminal.  So test it by opening a terminal and doing this:

adb devices

this should start the adb daemon and list all devices plugged into your USB ports which are in Debug Mode.

Finally, a cool dev tool is an app called Droid@Screen which can be used to display your Glass screen on your development computer screen.  you can get the latest version of it here:

http://droid-at-screen.ribomation.com/download/

The most current version was 1.0.2 to date of this publication.

In order to configure Droid@Screen we need to tell it where adb is.  The Android Studio.app folder structure we talked about is not recognized by most apps.  This it is necessary to create a symbolic link to our dab file. We can do this by using this command:

ln -s /Applications/Android Studio.app/sdk/platform-tools/adb /Applications/adb

which creates a symbolic link from the first URL via the second URL.  Now you can point your Droid@Screen configuration to this path.

You are ready to create Glass apps!

Any questions can be addressed to @santiapps.com

Advertisements

4 thoughts on “Develop apps for Google Glass – Part 3 – Setting up!

  1. Pretty section of content. I just stumbled upon your
    website and in accession capital to assert that I get in fact enjoyed account your blog posts.
    Any way I’ll be subscribing to your feeds and
    even I achievement you access consistently rapidly.

  2. Hi, tried setting all this up, I have Android Studio with the adb etc and also installed Droid@Screen. I have Google Glass plugged into the USB port and got Google Glass in Debug mode but can not see Glass in the list of devices ? Any ideas, thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s