6

What I am trying to do with my google glass is pretty simple: create/display a hello world card for google glass

issue is::

when i add this:

import com.google.android.glass.app.Card

I get This:

Cannot Resolve Symbol 'google'

I did this:

Minimum and Target SDK Versions: 15 (There is only one Glass version, so minimum and target SDK are the same.) Compile with: Glass Development Kit Sneak Peek

and i made a change to the gradel.build[compile sdk version...it was 15/changed to what is below]

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

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 15
    }
}

I feel like I'm missing something simple/a set up issue/not sure what it is.

got any suggestions?

Eugene Loy
  • 11,677
  • 8
  • 47
  • 73
JoeGlow
  • 111
  • 1
  • 3
  • Just to rule out other issues, do the sample projects import OK? They don't use gradle. Also what version of Android Studio? – mimming Dec 24 '13 at 08:15

3 Answers3

12

It looks like you have things set up correctly, but Android Studio is still under development, and can still be a bit glitchy when it comes to libraries and add-ons. Here are some troubleshooting steps that may help:

  • Re-import your project
  • Under module settings -> Project -> Project SDK -> Edit..., make sure that the Build Target is "Glass Development Kit Sneak Peek"
  • And if all else fails, you can add gdk.jar, found in sdk/add-ons/addon-google_gdk-google-15/libs, to your classpath by adding it as an external library.
mimming
  • 13,706
  • 3
  • 39
  • 73
  • 3
    Changing the Build Target to "Glass Development Kit Sneak Peek" fixed it for me. However, I must have a different version of Android Studio because I could not find the same options as described in the answer. Instead, I had to do this: File -> Other Settings -> Default Project Structure... -> SDKs (under Platform Settings) -> Android API 15 Platform -> Build target: Glass Development Kit Sneak Peek (4.0.3). – Tony Wickham Dec 23 '13 at 07:45
  • 1
    But now I just get the same error when I try to build the project... it just doesn't show up in red before then. -_- I can't figure out how to get this thing to compile, it keeps saying "Gradle: error: package com.google.android.glass.timeline does not exist" – Tony Wickham Dec 23 '13 at 08:46
5

The top answer is a bit old. Since the GDK is no longer a sneak peek, use:

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

Make sure you've downloaded the Glass Development Kit Preview from Tools > SDK Manager, and that you're running the latest version of Android Studio (0.55 and up.)

Lisa Wray
  • 2,204
  • 14
  • 22
  • After all this, when I try to build the APK, I still get a message "Error: Default Activity not found". – Arun Jul 17 '14 at 07:05
  • @Arun: That's fine! Just choose "Don't start activity". You should be able to install the app and launch via a voice trigger. – Lisa Wray Jul 17 '14 at 17:20
-2

Why don´t you use a sample to start your project? New Project -> Other -> Android Sample Project You can use the StopWatch to make that.

If you don´t want, be sure that your manifest has

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="15" />

Check if the GDK Sneak Peek is installed.

This message

Cannot Resolve Symbol 'google'

Look like a syntax error or a include error in your eclipse.

Check is the Glass Development Kit Sneak Peep is include as our library. Right Click your project -> Properties -> Java Build path -> Libraries Check too is your Project Build Target is correct on Android option.

Oximer
  • 518
  • 4
  • 18
  • What your describing is Eclipse. The question was for Android Studio, which Jenny & Tony pointed out is still very beta and doesn't have any glass template projects like Eclipse does that I'm aware of. I just tried your recommendation in Eclipse though and got an apk onto Glass for the first time so Cheers to that! USE ECLIPSE. – Mikeumus May 02 '14 at 05:38