Mona Jalal
Mona Jalal

Reputation: 38145

android:name="com.google.android.wearable.watchface.preview" watchface isn't recognized

I am following this two tutorials : tutorial 1 and tutorial 2. However in my AndroidManifest.xml file the following lines have an underline under watchface so I am wondering how I can fix it. Here's my source code: https://github.com/lamiastella/AndroidWearApp

enter image description here I am afraid I might have mistakes in my AndroidManifest.xml comparing to my solution tree shown here: enter image description here Besides I am receiving this error:

06-30 00:54:55.461    1361-1602/com.google.android.gms.wearable W/WearableConn﹕ Error writing to device, error: failed to connect to /10.0.2.2 (port 5601): connect failed: ECONNREFUSED (Connection refused)

enter image description here

Here's the code for AndroidManifest.xml:

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

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

    <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >

        <service
            android:name=".WeatherWatchFaceService"
            android:label="Weather"
            android:allowEmbedded="true"
            android:taskAffinity=""
            android:permission="android.permission.BIND_WALLPAPER" >
            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/watch_face" />
            <meta-data
                android:name="com.google.android.wearable.watchface.preview"
                android:resource="@drawable/preview" />
            <meta-data
                android:name="com.google.android.wearable.watchface.preview_circular"
                android:resource="@drawable/preview_circular" />
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
                <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
            </intent-filter>
        </service>
    </application>
</manifest>

Side note: I am not sure why there's a red cross on Android Wear run button. enter image description here enter image description here

You might ask what the problem is? I can't find the watchface program in the emulator. All I see is just a blue first page and then when I swipe it goes to an Agenda like what you see here: enter image description here enter image description here

Gradle:

Configuration on demand is an incubating feature.
:wear:preBuild UP-TO-DATE
:wear:preDebugBuild UP-TO-DATE
:wear:checkDebugManifest
:wear:preReleaseBuild UP-TO-DATE
:wear:prepareComAndroidSupportRecyclerviewV72200Library UP-TO-DATE
:wear:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:wear:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:wear:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:wear:prepareComGoogleAndroidSupportWearable120Library UP-TO-DATE
:wear:prepareDebugDependencies
:wear:compileDebugAidl UP-TO-DATE
:wear:compileDebugRenderscript UP-TO-DATE
:wear:generateDebugBuildConfig UP-TO-DATE
:wear:generateDebugAssets UP-TO-DATE
:wear:mergeDebugAssets UP-TO-DATE
:wear:generateDebugResValues UP-TO-DATE
:wear:generateDebugResources UP-TO-DATE
:wear:mergeDebugResources UP-TO-DATE
:wear:processDebugManifest UP-TO-DATE
:wear:processDebugResources UP-TO-DATE
:wear:generateDebugSources UP-TO-DATE
:wear:processDebugJavaRes UP-TO-DATE
:wear:compileDebugJava UP-TO-DATE
:wear:compileDebugNdk UP-TO-DATE
:wear:compileDebugSources UP-TO-DATE
:wear:preDexDebug UP-TO-DATE
:wear:dexDebug UP-TO-DATE
:wear:validateDebugSigning
:wear:packageDebug UP-TO-DATE
:wear:zipalignDebug UP-TO-DATE
:wear:assembleDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 3.701 secs

Here's what is in build.gradle (Module:wear)

apply plugin: 'com.android.application'


android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.mona.app1"
        minSdkVersion 21
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:1.2.0'
    compile 'com.google.android.gms:play-services-wearable:7.5.0'
}

Upvotes: 1

Views: 602

Answers (1)

Wayne Piekarski
Wayne Piekarski

Reputation: 3232

Your watch face is actually working fine.

Firstly, the underlines on com.google.android.wearable.watchface.preview actually happen in the official samples as well. This is the spell checker thinking there is a mistake.

Secondly, it actually installs correctly but you do not change watch faces by swiping to the app menu. To select a new watch face, press and hold on the screen for about 2 seconds, and then it will go to the special watch face selection screen. Your watch face will appear there, and you can make it active.

Upvotes: 3

Related Questions