我尝试编译并运行以下链接中的示例代码
https://github.com/mimming/gdk-hello-livecard-sample
我能够加载apk而不会出现任何错误,但是当我尝试做“确定玻璃”时,请展示一个演示'它给了我一个' Livecard已经停止,点击继续'
这里是logcat
03-17 11:41:44.085:W / dalvikvm(6315):拒绝重启开机DEX ' /system/framework/glass-core.jar' 03-17 11:41:44.093: D / AndroidRuntime(6315):关闭VM 03-17 11:41:44.093: W / dalvikvm(6315):threadid = 1:线程退出未捕获的异常 (group = 0x40db81f8)03-17 11:41:44.093:E / AndroidRuntime(6315):致命 例外:主03-17 11:41:44.093:E / AndroidRuntime(6315): java.lang.RuntimeException:无法实例化服务 com.google.android.glass.sample.livecard.LiveCardService: 抛出java.lang.ClassNotFoundException: com.google.android.glass.sample.livecard.LiveCardService 03-17 11:41:44.093:E / AndroidRuntime(6315):at android.app.ActivityThread.handleCreateService(ActivityThread.java:2237) 03-17 11:41:44.093:E / AndroidRuntime(6315):at android.app.ActivityThread.access $ 1600(ActivityThread.java:123)03-17 11:41:44.093:E / AndroidRuntime(6315):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1201) 03-17 11:41:44.093:E / AndroidRuntime(6315):at android.os.Handler.dispatchMessage(Handler.java:99)03-17 11:41:44.093:E / AndroidRuntime(6315):at android.os.Looper.loop(Looper.java:137)03-17 11:41:44.093: E / AndroidRuntime(6315):at android.app.ActivityThread.main(ActivityThread.java:4424)03-17 11:41:44.093:E / AndroidRuntime(6315):at java.lang.reflect.Method.invokeNative(Native Method)03-17 11:41:44.093:E / AndroidRuntime(6315):at java.lang.reflect.Method.invoke(Method.java:511)03-17 11:41:44.093: E / AndroidRuntime(6315):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 03-17 11:41:44.093:E / AndroidRuntime(6315):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)03-17 11:41:44.093:E / AndroidRuntime(6315):at dalvik.system.NativeStart.main(Native Method)03-17 11:41:44.093: E / AndroidRuntime(6315):引起:java.lang.ClassNotFoundException: com.google.android.glass.sample.livecard.LiveCardService 03-17 11:41:44.093:E / AndroidRuntime(6315):at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 03-17 11:41:44.093:E / AndroidRuntime(6315):at java.lang.ClassLoader.loadClass(ClassLoader.java:501)03-17 11:41:44.093:E / AndroidRuntime(6315):at java.lang.ClassLoader.loadClass(ClassLoader.java:461)03-17 11:41:44.093:E / AndroidRuntime(6315):at android.app.ActivityThread.handleCreateService(ActivityThread.java:2234) 03-17 11:41:44.093:E / AndroidRuntime(6315):... 10 more
感谢您的帮助
编辑:
我尝试过Jenny的建议,直接通过修改清单来启动StartLiveCardServiceActivity:
/* <service
android:name=".LiveCardService"
android:label="@string/app_name"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/live_card_show" />
</service> */
<activity
android:name=".StartLiveCardServiceActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
我得到了同样的错误,下面是logcat
03-17 20:13:00.264:W / dalvikvm(8914):拒绝重启开机DEX &#39; /system/framework/glass-core.jar' 03-17 20:13:00.280: D / AndroidRuntime(8914):关闭VM 03-17 20:13:00.280: W / dalvikvm(8914):threadid = 1:线程退出未捕获的异常 (group = 0x40db81f8)03-17 20:13:00.288:E / AndroidRuntime(8914):致命 例外:主03-17 20:13:00.288:E / AndroidRuntime(8914): java.lang.RuntimeException:无法实例化活动 ComponentInfo {com.google.android.glass.sample.livecard / com.google.android.glass.sample.livecard.StartLiveCardServiceActivity}: 抛出java.lang.ClassNotFoundException: com.google.android.glass.sample.livecard.StartLiveCardServiceActivity 03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880) 03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.ActivityThread.access $ 600(ActivityThread.java:123)03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1147) 03-17 20:13:00.288:E / AndroidRuntime(8914):at android.os.Handler.dispatchMessage(Handler.java:99)03-17 20:13:00.288:E / AndroidRuntime(8914):at android.os.Looper.loop(Looper.java:137)03-17 20:13:00.288: E / AndroidRuntime(8914):at android.app.ActivityThread.main(ActivityThread.java:4424)03-17 20:13:00.288:E / AndroidRuntime(8914):at java.lang.reflect.Method.invokeNative(Native Method)03-17 20:13:00.288:E / AndroidRuntime(8914):at java.lang.reflect.Method.invoke(Method.java:511)03-17 20:13:00.288: E / AndroidRuntime(8914):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784) 03-17 20:13:00.288:E / AndroidRuntime(8914):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)03-17 20:13:00.288:E / AndroidRuntime(8914):at dalvik.system.NativeStart.main(Native Method)03-17 20:13:00.288: E / AndroidRuntime(8914):引起:java.lang.ClassNotFoundException: com.google.android.glass.sample.livecard.StartLiveCardServiceActivity 03-17 20:13:00.288:E / AndroidRuntime(8914):at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 03-17 20:13:00.288:E / AndroidRuntime(8914):at java.lang.ClassLoader.loadClass(ClassLoader.java:501)03-17 20:13:00.288:E / AndroidRuntime(8914):at java.lang.ClassLoader.loadClass(ClassLoader.java:461)03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 03-17 20:13:00.288:E / AndroidRuntime(8914):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 03-17 20:13:00.288:E / AndroidRuntime(8914):... 11 more