每当我运行示例代码时,我总是得到:
java.lang.NoClassDefFoundError:com.google.android.glass.app.Card
logcat的:
VFY: unable to resolve new-instance 744 (Lcom/google/android/glass/app/Card;) in Lcom/book/thinkforglass/GDKHelloWorld;
VFY: replacing opcode 0x22 at 0x0003
DexOpt: unable to opt direct call 0x146f at 0x05 in Lcom/book/thinkforglass/GDKHelloWorld;.onCreate
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40e042a0)
FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.glass.app.Card
at com.book.thinkforglass.GDKHelloWorld.onCreate(GDKHelloWorld.java:15)
at android.app.Activity.performCreate(Activity.java:5191)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1036)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:803)
at dalvik.system.NativeStart.main(Native Method)
Sending signal. PID: 13743 SIG: 9
我正在使用:谷歌开发先锋[Android 4.0.3] 我有一个运行在 4.1.2
的设备并且还使用最小/目标 SDK 版本15
的Manifest.xml: -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.book.thinkforglass"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<uses-permission
android:name="com.google.android.glass.permission.DEVELOPMENT" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher" >
<activity
android:name="com.book.thinkforglass.GDKHelloWorld"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher" >
<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/voice_trigger" />
</activity>
</application>
</manifest>
我的设备支持 Android版本 - 4.1.2