Problem:

After installing Android Studio Beta and using the wizard to create a new wearable app, the Gradle build failed with the following errors:

Error: Failed to find: com.google.android.gms:play-services-wearable:+
Error: Failed to find: com.google.android.support:wearable:+

Solution:

[Update]Additional useful information: http://developer.android.com/preview/google-play-services-wear.html[/Update]

[Update 7/16/14]The latest version of Android Studio extends Activity for watches rather than WatchActivity[/Update]

Until we get an official update, there is a work around I found on this site.

1. Open your Android SDK Manager.
2. Click on Tools -> Manage Add-on Sites… -> User Defined Site
3. Add https://dl-ssl.google.com/android/repository/addon-play-services-5.xml
4. Update your extras (Google Play Services and Google Repository)
5. Sync your project in Android Studio

Even after that, WatchActivity is still missing. Switching from WatchActivity to Activity seems to work but is probably not a good long term solution. Android Studio should now extend Activity instead of WatchActivity. If the wizard creates a project extending WatchActivity, update Android Studio. OK, now everything is building but the install fails for the emulator: Failure [INSTALL_FAILED_OLDER_SDK]

Changing the minSdkVersion, targetSdkVersion and compiledSdkVersion to 20 did the trick. Right now the watch system images are available at API 20 but the wizard sets everything up with ‘L’. Again, let’s hope this is resolved soon. Finally, I was able to get ‘Hello Round World!’ to show up on the emulator.

build.gradle in the wear folder

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId 'com.example.cblack.myapplication'
        minSdkVersion 20
        targetSdkVersion 20
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

Hopefully Google releases an update soon. I would expect another Android SDK Manager and Watch SDK update shortly that resolves these issues. I’m excited to start building apps for watches! Stay tuned for more wearable examples.