【发布时间】:2014-11-30 14:21:26
【问题描述】:
我正在尝试使用 EyeGestureLib 从 Glass 中检查 Wink。
我创建了一个新项目,并完全按照那个人对示例项目 here 所做的事情。
我的代码的问题部分如下:
private EyeGestureManager mEyeGestureManager;
private EyeGestureListener mEyeGestureListener;
private EyeGesture target1 = EyeGesture.WINK;
private EyeGesture target2 = EyeGesture.DOUBLE_BLINK;
在 onCreate 里面,我有:
mEyeGestureManager = EyeGestureManager.from(this);
mEyeGestureListener = new EyeGestureListener();
// print out each eye gesture is supported or not
for (EyeGesture eg : EyeGesture.values()) {
boolean supported = mEyeGestureManager.isSupported(eg);
Log.d(TAG, eg.name() + ":" + supported);
}
我的程序在打开后立即崩溃。我意识到问题出在它尝试访问时
mEyeGestureManager。代码中使用 mEyeGestureManager 的任何地方都会导致程序崩溃。根据我的观察,mEyeGestureManager 即使在mEyeGestureManager = EyeGestureManager.from(this); 之后也是空的
当我改变时
mEyeGestureManager = EyeGestureManager.from(this);
到
mEyeGestureManager = new EyeGestureManager();
它会停止崩溃,并且 mEyeGestureManager 不再为空,但不会检测到眨眼或双眨眼。
我的 Glass 运行的是 XE21,但我将其降级为 XE18.3,因为我的研究表明 EyeGestureLib 在 Glass 版本 > XE18.3 上无法正常工作。
EyeGestures NOT working in 19.1
https://github.com/thorikawa/EyeGestureLib/issues/2
现在我有 XE18.3,但它不工作。当我有时,Wink 不工作 mEyeGestureManager = new EyeGestureManager(); 我得到:
Supported:﹕ BLINK:false
Supported:﹕ DOFF:false
Supported:﹕ DON:false
Supported:﹕ DOUBLE_BLINK:false
Supported:﹕ DOUBLE_WINK:false
Supported:﹕ LOOK_AT_SCREEN:false
Supported:﹕ LOOK_AWAY_FROM_SCREEN:false
Supported:﹕ WINK:false
但是当我有的时候:
mEyeGestureManager = EyeGestureManager.from(this);
它立即崩溃。
我去安装了already compiled example "EyeGestureDemo-debug-1.1.apk",它工作非常好,但我的却没有。
我做错了什么?我已经尝试了 3 天了。谷歌没有为此提供官方 API,但我不想等到他们发布一个。我需要这个尽快用于我的学校项目。 有人知道可能是什么问题吗?
编辑: 崩溃日志
12-02 09:39:54.347 3758-3758/com.inno.inno.glassplugin D/AndroidRuntime﹕ Shutting down VM
12-02 09:39:54.347 3758-3758/com.inno.inno.glassplugin W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41f78bd8)
12-02 09:39:54.363 3758-3758/com.inno.inno.glassplugin E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.inno.inno.glassplugin, PID: 3758
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.inno.inno.glassplugin/com.inno.inno.glassplugin.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2235)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2285)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5061)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.inno.inno.glassplugin.MainActivity.onCreate(MainActivity.java:92)
at android.app.Activity.performCreate(Activity.java:5236)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1089)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2285)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5061)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
【问题讨论】:
-
任何错误信息?能分享一下日志吗?我记得该库在旧 XE 上运行良好。
-
我刚刚附上了崩溃日志。谢谢
标签: google-glass google-gdk google-mirror-api