Loading Google Glass GDK sample

2019-08-02 00:27发布

问题:

I have a problem to load Google Glass GDK sample (Compass, Stopwatch, or Timer) to my google-glass. I use Eclipse for this. In the console, it shows me successful message

[2014-04-20 19:42:56 - Compass] Installing Compass.apk... [2014-04-20 19:42:58 - Compass] Success! [2014-04-20 19:42:58 - Compass] /Compass/bin/Compass.apk installed on device [2014-04-20 19:42:58 - Compass] Done!

This post suggests I use a voice trigger to activate the service (e.g.: "ok glass, show a compass"). But it doesn't work for me. I also tried another suggestion from different post to go to Run/ Debug configuration to specify exactly which activity to run. But in my case, the "Launch" option under "Android" Tab doesn't give me any selection.

My google glass version is currently XE12.1

Thank you in advance for the help!

回答1:

If the sample projects you are using are from the Android SDK API Level 19 samples folder, or Github, then these projects have been updated to work with XE16 and won't work on XE12.X.

You'll need to use the samples under the API Level 15 folder on XE12.X.

Or, update your Glass to XE16, and then the most recent version of the samples should work for you.

All versions of sample projects are activated by voice command (e.g., "ok glass, show a compass").



回答2:

Use this adb command from the command line on a PC or Terminal on a mac:

adb shell am start -n com.google.android.glass.sample.compass/com.google.android.glass.sample.compass.CompassMenuActivity

While Glass is ADB connected and is the only ADB device connected.

This should launch the Compass activity for you on XE12.

I got the package name and activity name from here:

https://github.com/googleglass/gdk-compass-sample/blob/master/AndroidManifest.xml

Perhaps if you are using different code, you'll need to tweak the adb shell command.