Google Glass: GDK with Android Studio

Smalesy picture Smalesy · Nov 20, 2013 · Viewed 10.4k times · Source

I’m trying to use the new Google Glass Development kit with Android Studio. Unfortunately I'm not having much success.

I get the error: "Gradle: package com.google.android.glass.touchpad does not exist"

I've added uses-library to the manifest as follows:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme" >

    <uses-library
        android:name="com.google.android.glass"
        android:required="true" />


    <activity
        android:name="com.glass.test.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Then I've added the gdk.jar to the libs directory. And I've added the following to the dependency section of my build.gradle.

dependencies {
    compile files('libs/gdk.jar')
}

Any help with this would be very appreciated.

Answer

Tony Allevato picture Tony Allevato · Nov 21, 2013

Change the compileSdkVersion in your build.gradle file to refer directly to the GDK add-on:

android {
    compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
    buildToolsVersion "19.0.2"

    // other stuff...
}

(The buildToolsVersion can be newer than 19.0.2 if you have a higher version of the SDK installed, as long as it's at least 19.0.2.)