我正在开发我的第一个玻璃器皿。一切正常,但共享时间线项目会导致玻璃崩溃。当我从操作中选择共享选项时,Glass 会要求我选择联系人。当我选择联系人时,它会显示共享进度,然后显示共享消息,大约一秒钟后,Glass 意外停止,Glass Home 再次启动。我不会收到关于我的时间线中重复的回调 url 和时间线项目的通知,只有删除操作可用。我检查了 Glass 的日志并得到以下异常:
09-16 18:45:57.986 18588-18638/? W/dalvikvm: threadid=28: thread exiting with uncaught exception (group=0x40db11f8)
09-16 18:45:57.994 18588-18638/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #12
java.lang.IllegalStateException: Expected condition to be true.
at com.google.glass.predicates.Assert.assertTrue(Assert.java:82)
at com.google.glass.share.ShareTimelineItemJob$4.onExecute(ShareTimelineItemJob.java:305)
at com.google.glass.timeline.TimelineHelper$Update.execute(TimelineHelper.java:279)
at com.google.glass.timeline.TimelineHelper.atomicUpdateTimelineItem(TimelineHelper.java:638)
at com.google.glass.share.ShareTimelineItemJob.updateToFinalShareItem(ShareTimelineItemJob.java:349)
at com.google.glass.share.ShareTimelineItemJob.run(ShareTimelineItemJob.java:154)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
09-16 18:45:58.033 189-3487/? W/ActivityManager: Force finishing activity com.google.glass.home/.timeline.MainTimelineActivity
09-16 18:45:58.088 18588-18588/? I/ShareActivity: onPause: 428d7a80
09-16 18:45:58.119 697-1145/? W/VoiceEngine: Stopping reading from microphone because read < 0
09-16 18:45:58.119 697-1145/? W/VoiceEngine: Stopped reading from microphone
09-16 18:45:58.135 189-494/? I/ActivityManager: START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.google.glass.home/.timeline.MainTimelineActivity} from pid 0
我正在使用 Java 示例项目。这是我插入时间线项目的代码
TimelineItem timelineItem = new TimelineItem();
List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem().setAction("SHARE"));
timelineItem.setMenuItems(menuItemList);
timelineItem.setText("Hello Glass");
// Triggers an audible tone when the timeline item is received
timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT"));
MirrorClient.insertTimelineItem(credential, timelineItem);
我究竟做错了什么?
更新:我尝试了来自操场的请求,它也导致了异常
{
"kind": "mirror#timelineItem",
"id": "1100196a-10b1-4ce4-9639-6e75b5a8c881",
"created": "2013-09-17T09:25:29.818Z",
"updated": "2013-09-17T09:25:29.818Z",
"etag": "\"hzfI85yu0lKQdtWV4PO1jAbQxWw/Tth-2CVHTjXcdWQ64xW2tMt--sk\"",
"text": "This item auto-resizes according to the text length",
"menuItems": [
{
"action": "SHARE"
}
],
"notification": {
"level": "DEFAULT"
}
}