Search code examples
androidgoogle-glassgoogle-gdk

Not able to run Google Glass developers Samples


I'm starting developing some apps on Google Glass and I've tried to run the sample project that appears on the official developers.google.com/ page charades sample but when I import them on my Android Studio (Beta 0.8.6) it doesn't resolve all the imports.

import com.google.android.glass.media.Sounds;
import com.google.android.glass.touchpad.Gesture;
import com.google.android.glass.touchpad.GestureDetector;

The package of the project is

package com.google.android.glass.sample.charades;

seems that they hadn't upload all the project files. Any suggestion?


Solution

  • It's an importing issue: when importing the project, Android Studio assigns a wrong SDK to the module.

    You need to change the SDK in build.gradle.

    from

    compileSdkVersion 21
    

    to

    compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
    

    so the build.gradle (Module: app) should look like:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
        buildToolsVersion "21.0.2"
    
        defaultConfig {
            applicationId "com.google.android.glass.sample.charades"
            minSdkVersion 19
            targetSdkVersion 19
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }