Android Wear应用没有出现在"启动..."值班菜单

Android Wear应用没有出现在"启动..."值班菜单

问题描述:

我添加了一个穿模块到我的Andr​​oid Studio中的Andr​​oid应用。在移动模块,我已经在移动应用程序指定该行的build.gradle:

I have added a wear module to my Android Application in Android Studio. In the mobile module, I have specified this line in the mobile applications build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:+'
    compile "com.android.support:support-v4:20.0.+"
    wearApp project(':wear')
}

此外,这里是我的Andr​​oidManifest.xml的穿模块。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.my.wear" >

    <uses-feature android:name="android.hardware.type.watch" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

在logcat中,我看到的应用程序安装在手表中的消息。

In logcat, I see the messages that the application is installed on the watch.

09-16 17:12:03.075: D/WearablePkgInstaller(1023): Got PackageUpdateReceiver message Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.myapplication flg=0x4000010 cmp=com.google.android.wearable.app/com.google.android.clockwork.companion.packagemanager.PackageUpdateReceiver (has extras) }

不过,我不能去开始... 查找应用程序!有什么明显的我失踪?

However, I can't go to Start... to find the application! Is there something obvious I'm missing?

我是缺少来自该行的耐磨的Andr​​oidManifest.xml

I was missing this line from the wearable AndroidManifest.xml

更具体地说,这需要在XML结构的应用程序部分。

More specifically, this needs to be in the application section of the xml structure.

<application
    android:icon="@drawable/ic_launcher"
    ... >

    <meta-data android:name="com.google.android.clockwork.home.preview" 
        android:resource="@drawable/ic_launcher" />