Google Glass GDK – Setting up the project

Uncategorized By 3 years ago

I am hoping that you guys have read my previous blog where i explained the termonologies related to Glass. In this blog i’ll be explaining how to set up a project in Android Studio for Google Glass.

So before you start developing there are few perquisites to follow up. These are –

Step 1

Make sure you have GDK installed, which you can install from SDK Manager. It is listed under API 15.

Step 2

If you are using latest Android Studio, it means you are using gradle build system. In that case you need to change the following lines in your build.gradle –

android {
compileSdkVersion "Google Inc.:Glass Development Kit Sneak Peek:15"
buildToolsVersion '19.0.0'

defaultConfig {
minSdkVersion 15
targetSdkVersion 15
}
}

Or you can set all this while creating the project but sometime these settings do not take effect automatically in build.gradle file so beware for that and make sure these lines exist in your build.gradle.

Step 3

If you want your app to look native to Glass then you should not be using any theme for your app as Glass take good care of that for you. So in order to make sure that your app doesn’t use using any theme, go to your AndroidManifest file and remove the android:theme line which is located under application tag. And just to be an extra careful check the activity tag as well, if there is any theme has been set there by default then remove it. But if you have to have a custom theme in your project, just create one in style.xml and extend it with Theme.DeviceDefault to make sure you don’t lose the native app feel of the Glass.

That’s all. You project has been set up now. In next blog we’ll learn about how to create static and live cards and add them to timeline.

Cheers!!

  • marciokoko

    Thanks so much. For some reason, even if i told AS it was to be compiled with GDK from the creation of the New Project, there was no mention of the GDK in the build.gradle.

    • varun_b2cloud

      Yes, i noticed the similar behaviour that is why i mentioned in step 2 that even you set the GDK as compile SDK but still make sure these lines exist in build.gradle otherwise your project will never compile with GDK.
      I am glad you find this blog useful. Cheers!!