Erik B
Erik B

Reputation: 2858

Trouble setting up Hello, World watch app in Android Studio

When deploying the wear version of the included Hello, World watch app in Android Studio I get this error: Failure [INSTALL_FAILED_OLDER_SDK]

Update: Removing details about trying a hacked version of L from the Reddit post as that was not a solution for me and it may have created more confusion.

mobile/build.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.erikbabel.myapplication"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

wear/build.gradle

apply plugin: 'com.android.application'


android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

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

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

Everything else is untouched from the New Project directions. I'm running on my Moto Ultra 4.4 and the LG G watch.

Upvotes: 3

Views: 3087

Answers (2)

computermacgyver
computermacgyver

Reputation: 822

OP has solved this issue, noting that a wearable app can be deployed directly to the wearable device for debugging, but not to a phone. The other option is to package the wearable app inside of a handheld app and deploy the handheld app to the phone. This will then cause the wearable app to be deployed to the wearable device paired with the phone. As of writing this, this is the only method to include a wearable app in the Play Store.

When publishing to users, you must package a wearable app inside of a handheld app, because users cannot browse and install apps directly on the wearable. If packaged properly, when users download the handheld app, the system automatically pushes the wearable app to the paired wearable.

Note: This feature doesn't work when you are signing your apps with a debug key when developing. While developing, installing apps with adb install or Android Studio directly to the wearable is required.

Source: https://developer.android.com/training/wearables/apps/packaging.html

Upvotes: 0

Erik B
Erik B

Reputation: 2858

The error [INSTALL_FAILED_OLDER_SDK] is because I was deploying the wear gradle build to the phone (which has an incompatible api). In order to deploy the wearable gradle build to the LG G watch, you have to enable bluetooth debugging and connect your adb to the watch. Then select the watch in the Choose Device dialog.

Upvotes: 4

Related Questions