如何在设备上运行谷歌的玻璃GDK样?玻璃、设备、如何在、GDK

2023-09-06 11:12:05 作者:日久生厌

我开始开发谷歌玻璃应用与GDK。

I start developing Google Glass app with GDK .

我使用Eclipse与Android SDK管理器来安装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:

点击文件>新建项目>的Andr​​oid示例项目 选择玻璃开发工具包作为构建目标,然后单击下一步。 选择定时器样品,然后点击完成 在Eclipse的Package Explorer中,右键单击该样本并选择运行方式> Android应用程序玻璃连接到您的开发系统。 Click File > New Project > Android Sample Project Select Glass Development Kit as the build target and click Next. Select the Timer sample and click Finish. In the Eclipse Package Explorer, right click the sample and select Run as > Android Application with Glass connected to your development system.

在谷歌玻璃(版本XE12)连接,但没有显示出来。于是,我跟着另外一个教程在线启动应用程序手动使用亚洲开发银行命令:

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 ?

在另一方面,我做了一个应用程序类似,使用Eclipse Android的例子。当我点击运行方式>在Eclipse菜单栏中的Andr​​oid应用程序,控制台说:

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] ------------------------------

这与该错误消息没有启动的活动找到了! ?谈到这个错误,我发现了一个回答在堆栈溢出。我应该在哪里放线以下的Andr​​oidManifest.xml

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>

谷歌玻璃的调试模式为ON(是的,我可以看到设备在Eclipse)

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.