Kamilski81
Kamilski81

Reputation: 15127

How do I distribute my Android Wear to alpha/beta users on Google Play Store?

I am testing my application and am in Alpha mode. My app is approved and I can find it in alpha mode in the Play Store. However, the 'wear' portion of my app is not being automatically installed to the wear.

My wear app currently has minimal functionality, so the "opt-in" for the wear keeps getting denied. I would still like to be able to package my minimal wear app for my alpha users, but it doesn't seem to be working. Any ideas how I can get auto-install of the wear-portion of the app?

Here are my files currently:

/build.gradle

// Used in 'mobile' and 'wear' submodules
def versionMajor() { 0 }
def versionMinor() { 0 }
def versionPatch() { 8 }

def gitVersion() {
    def process = "git rev-list master --first-parent --count".execute()
    return process.text.toInteger()
}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

/mobile/build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.kamil.coach"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode gitVersion()
        versionName "${versionMajor()}.${versionMinor()}.${versionPatch()}"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'APK META-INF/NOTICE.txt'
        exclude 'APK META-INF/notice.txt'
    }
}

if(project.hasProperty("MyProject.signing") && new File(project.property("MyProject.signing") + ".gradle").exists()) {
    println "mobile applying gradle file"
    apply from: project.property("MyProject.signing") + ".gradle";
} else {
    println "mobile not applying gradle file"
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':core')
    wearApp project(':wear')
    compile "com.android.support:appcompat-v7:22.1.0"

    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.google.android.support:wearable:1.1.0'
    compile 'com.google.android.gms:play-services-wearable:7.3.0'
    compile 'org.apache.commons:commons-lang3:3.0'
    compile 'joda-time:joda-time:2.7'
    compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'

    compile 'com.uservoice:uservoice-android-sdk:+'

    compile(name:'cloud-release', ext:'aar')
    compile(name:'auth-release', ext:'aar')
    compile(name:'core-release', ext:'aar')
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

/wear/build.gradle

apply plugin: 'com.android.application'


android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.kamil.coach"
        minSdkVersion 20
        targetSdkVersion 22
        versionCode gitVersion()
        versionName "${versionMajor()}.${versionMinor()}.${versionPatch()}"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude 'APK META-INF/NOTICE.txt'
        exclude 'APK META-INF/notice.txt'
    }
}

if(project.hasProperty("MyProject.signing") && new File(project.property("MyProject.signing") + ".gradle").exists()) {
    println "wear applying gradle file"
    apply from: project.property("MyProject.signing") + ".gradle";
} else {
    println "wear not applying gradle file"
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':core')
    compile 'com.google.android.support:wearable:1.1.0'
    compile 'com.google.android.gms:play-services-wearable:7.3.0'
    compile 'org.apache.commons:commons-lang3:3.0'

    compile(name:'cloud-release', ext:'aar')
    compile(name:'auth-release', ext:'aar')
    compile(name:'core-release', ext:'aar')
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

/core/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 17
        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.android.support:appcompat-v7:22.0.0'


    compile 'com.squareup.retrofit:retrofit:1.9.+'
}

/mobile/AndroidManifest.xml

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

    <uses-feature android:name="android.hardware.sensor.accelerometer"/>
    <uses-feature android:name="android.hardware.sensor.gyroscope"/>

    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
        android:name=".mobile.MobileKamilApplication"
        android:allowBackup="true"
        android:icon="@drawable/launcher_icon"
        android:label="@string/app_name"
        android:theme="@style/CoachTheme"
        >

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

        .
        .
        .
    </application>

</manifest>

/wear/AndroidManifest.xml

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

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

    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

    <application
        android:name="com.core.KamilApplication"
        android:allowBackup="true"
        android:icon="@drawable/launcher_icon"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault"
        >

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>

        .
        .
        .
        .

    </application>

</manifest>

Upvotes: 9

Views: 736

Answers (2)

Kamilski81
Kamilski81

Reputation: 15127

I was embedding an aar file which was causing the permissions error.
I had to copy the permissions from within that aar file into my mobile app.

I solved this by using 'adb logcat' on the wear as my mobile-release.apk tried to install from the wear and found out what the issue was.

Upvotes: 0

CodeChimp
CodeChimp

Reputation: 4835

The wear app must be packaged within the main app, it isn't distributed separately. You just upload the release apk for the mobile app to the Play Store alpha channel as normal.

Both apps must have the same package name, be signed with the same key and within the mobile gradle depencies you must include the wearable project

wearApp project(':wearable')

See the full Google docs for more details. http://developer.android.com/training/wearables/apps/packaging.html

Upvotes: 1

Related Questions