如何在设备上运行Google Glass GDK示例? [英] How to run a Google Glass GDK sample on the device?

查看:193
本文介绍了如何在设备上运行Google Glass GDK示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用GDK开发Google Glass应用程序。



我用Eclipse SDK Manager安装GDK。



之后,我按照以下步骤导入Google Glass项目: here


  1. 点击文件>新建项目> Android示例项目

  2. 选择玻璃开发套件作为构建目标,然后单击下一步。

  3. 选择计时器示例,然后单击完成

  4. 在Eclipse Package Explorer中,右键单击该示例,然后选择运行为> A​​ndroid应用,将Glass连接到您的开发系统。 / li>

Google Glass(XE12版)已连接,但没有显示。然后,我遵循另一个教程在线使用 adb 命令手动启动应用程序:

  ./ adb shell am start -n com.google.android.glass.sample.timer / .MenuActivity 

但是结果是权限拒绝:

  $ ./adb shell am start -n com.google.android.glass.sample。 timer / .MenuActivity 
开始:Intent {cmp = com.google.android.glass.sample.timer / .MenuActivity}
java.lang.SecurityException:权限拒绝:启动Intent {flg = 0x10000000 cmp = com.google.android.glass.sample.timer / .MenuActivity} from null(pid = 2938,uid = 2000)未从uid导出10032
在android.os.Parcel.readException(Parcel.java:1327)
在android.os.Parcel.readException(Parcel.java:1281)
在android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1631)
at com.android.commands.am.Am.runStart(Am.java:441)
at com.android.commands.am.Am.run(Am.java:108)
在com.android.commands.am.Am.main(Am.java:81)
在com.android.internal.os.RuntimeInit.finishInit(本机方法)
在com.android.internal。 os.RuntimeInit.main(RuntimeInit.java:238)
at dalvik.system.NativeStart.main(Native Method)

如何解决问题?



另一方面,我做了一个类似于使用Eclipse的Android示例的应用程序。在Eclipse菜单栏中单击运行为> A​​ndroid应用程序后,控制台说:

  [2014-01-06 18:55 :10  -  Glass001] Android Launch! 
[2014-01-06 18:55:10 - Glass001] adb正常运行。
[2014-01-06 18:55:10 - Glass001]没有发现Launcher活动!
[2014-01-06 18:55:10 - Glass001]启动将只同步设备上的应用程序包!
[2014-01-06 18:55:10 - Glass001]执行同步
[2014-01-06 18:55:10 - Glass001]自动目标模式:无法检测设备兼容性。请选择目标设备。
[2014-01-06 18:55:17 - Glass001]将Glass001.apk上传到设备'015DBXXXXXX701C'
[2014-01-06 18:55:17 - Glass001]安装Glass001.apk。 ..
[2014-01-06 18:55:20 - Glass001]成功!
[2014-01-06 18:55:20 - Glass001] /Glass001/bin/Glass001.apk安装在设备上
[2014-01-06 18:55:20 - Glass001]完成!
[2014-01-06 18:56:48 - Glass001] ------------------------------

这是否与错误消息No Launcher activity found! ?参考这个错误,我在Stack Overflow中找到了一个 answer 。我应该把这些行放在以下 AndroidManifest.xml

  < manifest xmlns:android =http://schemas.android.com/apk/res/android
package =com.google.android.glass.sample.timer
android:versionCode =2
android:versionName =1.0>

< uses-sdk
android:minSdkVersion =15
android:targetSdkVersion =15/>

< application
android:allowBackup =true
android:icon =@ drawable / ic_timer
android:label =@ string / app_name >

< activity
android:name =com.google.android.glass.sample.timer.MenuActivity
android:label =@ string / app_name
android:theme =@ style / MenuTheme
android:enabled =true>
< / activity>

< activity
android:name =com.google.android.glass.sample.timer.SetTimerActivity
android:label =@ string / app_name
android:enabled =true>
< / activity>

< activity
android:name =com.google.android.glass.sample.timer.SelectValueActivity
android:label =@ string / app_name
android:enabled =true>
< / activity>

< service
android:name =com.google.android.glass.sample.timer.TimerService
android:icon =@ drawable / ic_timer
android:label =@ string / app_name
android:enabled =true
android:exported =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 / voice_trigger_start/>
< / service>

< / application>

< / manifest>

Google Glass的调试模式已打开(是的,我可以在Eclipse中看到该设备)

解决方案

您需要设置一个适用于此的调试配置。原来这个应用程序将无法启动而无需用户交互。如果您进入调试下拉菜单并说配置,您可以自动启动您选择的活动。所以在顶部选择项目,然后当它询问要做什么说自动启动活动与旁边的下拉框。使用下拉菜单选择要自动启动的活动。然后尝试调试应用程序,它应该在您的玻璃杯上自动启动。


I start developing Google Glass app with GDK .

I use Eclipse with Android SDK Manager to install the GDK.

After that, I import the Google Glass project following the steps mentioned here:

  1. Click File > New Project > Android Sample Project
  2. Select Glass Development Kit as the build target and click Next.
  3. Select the Timer sample and click Finish.
  4. In the Eclipse Package Explorer, right click the sample and select Run as > Android Application with Glass connected to your development system.

The Google Glass (version XE12) is connected, but nothing shows up. Then, I follow another tutorial online to launch the App manually using an adb command:

./adb shell am start -n com.google.android.glass.sample.timer/.MenuActivity

But the result is a Permission Denial:

$ ./adb shell am start -n com.google.android.glass.sample.timer/.MenuActivity
Starting: Intent { cmp=com.google.android.glass.sample.timer/.MenuActivity }
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.google.android.glass.sample.timer/.MenuActivity } from null (pid=2938, uid=2000) not exported from uid 10032
    at android.os.Parcel.readException(Parcel.java:1327)
    at android.os.Parcel.readException(Parcel.java:1281)
    at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1631)
    at com.android.commands.am.Am.runStart(Am.java:441)
    at com.android.commands.am.Am.run(Am.java:108)
    at com.android.commands.am.Am.main(Am.java:81)
    at com.android.internal.os.RuntimeInit.finishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:238)
    at dalvik.system.NativeStart.main(Native Method)

How to solve the problem ?

On the other hand, I made an App similar to the Android example using Eclipse. After I click Run as > Android Application in Eclipse menu bar, the console said:

[2014-01-06 18:55:10 - Glass001] Android Launch!
[2014-01-06 18:55:10 - Glass001] adb is running normally.
[2014-01-06 18:55:10 - Glass001] No Launcher activity found!
[2014-01-06 18:55:10 - Glass001] The launch will only sync the application package on the device!
[2014-01-06 18:55:10 - Glass001] Performing sync
[2014-01-06 18:55:10 - Glass001] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-01-06 18:55:17 - Glass001] Uploading Glass001.apk onto device '015DBXXXXXX701C'
[2014-01-06 18:55:17 - Glass001] Installing Glass001.apk...
[2014-01-06 18:55:20 - Glass001] Success!
[2014-01-06 18:55:20 - Glass001] /Glass001/bin/Glass001.apk installed on device
[2014-01-06 18:55:20 - Glass001] Done!
[2014-01-06 18:56:48 - Glass001] ------------------------------

Does this relate to the error message "No Launcher activity found!" ? Referring to this error, I found an answer in Stack Overflow. Where should I put the lines in the following AndroidManifest.xml?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.glass.sample.timer"
    android:versionCode="2"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="15" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_timer"
        android:label="@string/app_name" >

        <activity
            android:name="com.google.android.glass.sample.timer.MenuActivity"
            android:label="@string/app_name"
            android:theme="@style/MenuTheme"
            android:enabled="true" >
        </activity>

        <activity
            android:name="com.google.android.glass.sample.timer.SetTimerActivity"
            android:label="@string/app_name"
            android:enabled="true" >
        </activity>

        <activity
            android:name="com.google.android.glass.sample.timer.SelectValueActivity"
            android:label="@string/app_name"
            android:enabled="true" >
        </activity>

        <service
            android:name="com.google.android.glass.sample.timer.TimerService"
            android:icon="@drawable/ic_timer"
            android:label="@string/app_name"
            android:enabled="true"
            android:exported="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/voice_trigger_start" />
        </service>

    </application>

</manifest>

Debug mode of Google Glass is ON (Yes, I can see the device in Eclipse)

解决方案

You need to set up a debug configuration that will work for this. Originally this application won't start without user interaction. If you go to the debug drop-down and say configure you can have it auto start an activity of your choice. So at the top pick the project then when it asks what to do say auto launch activity with the drop-down box next to it. Use the drop-down to select the activity you want to auto-start. Then try debugging the application and it should push and start automatically on your glass.

这篇关于如何在设备上运行Google Glass GDK示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆