问题
I ran the timer, stopwatch, and compass example here:
https://developers.google.com/glass/develop/gdk/quick-start#for_android_beginners
However, the application builds but doesn't run. This is all I can get in logcat:
[2013-11-19 15:58:21 - CompassMenuActivity] ------------------------------
[2013-11-19 15:58:21 - CompassMenuActivity] Android Launch!
[2013-11-19 15:58:21 - CompassMenuActivity] adb is running normally.
[2013-11-19 15:58:21 - CompassMenuActivity] No Launcher activity found!
[2013-11-19 15:58:21 - CompassMenuActivity] The launch will only sync the application package on the device!
[2013-11-19 15:58:21 - CompassMenuActivity] Performing sync
[2013-11-19 15:58:21 - CompassMenuActivity] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2013-11-19 15:58:23 - CompassMenuActivity] Uploading CompassMenuActivity.apk onto device '0***************0C'
[2013-11-19 15:58:23 - CompassMenuActivity] Installing CompassMenuActivity.apk...
[2013-11-19 15:58:24 - CompassMenuActivity] Success!
[2013-11-19 15:58:24 - CompassMenuActivity] /CompassMenuActivity/bin/CompassMenuActivity.apk installed on device
[2013-11-19 15:58:24 - CompassMenuActivity] Done!
I'm using
Eclipse Standard/SDK
Version: Kepler Release Build id: 20130614-0229
回答1:
Using the "Run as" menu in Eclipse will only install the APK on the device but won't run it, because none of the application components in the manifest have android.intent.category.LAUNCHER
.
Instead, after the APK is installed, you can use the voice trigger on Glass to start it. For example, say "ok glass, show a compass" for the Compass sample. This will start the CompassService
service that publishes the live card to the timeline.
回答2:
In addition to use voice trigger or touch menu to launch, you can also use adb command to launch the service, this will save some time, because it gets kind of old to manually navigate to launch the app.
adb shell am startservice com.google.android.glass.compass/com.google.android.glass.sample.compass.CompassService
adb shell am startservice com.google.android.glass.timer/com.google.android.glass.sample.timer.TimerService
adb shell am startservice com.google.android.glass.stopwatch/com.google.android.glass.sample.stopwatch.StopwatchService:
or
adb shell am startservice <name of service>
adb shell am start <name of activity>
回答3:
Please make sure you have XE11 update, otherwise it wont' work.
回答4:
You can also edit the debug configuration. The second section should have a launch activity option. Since you don't have a default (because it is triggered by the voice intent) you can select one from the project manually. this will then auto launch the main activity when you debug the application.
来源:https://stackoverflow.com/questions/20084787/running-timer-stopwatch-and-compass-example-on-glass-doesnt-seem-to-work