【问题标题】:How do I distribute my Android Wear to alpha/beta users on Google Play Store?如何将我的 Android Wear 分发给 Google Play 商店中的 alpha/beta 用户?
【发布时间】:2015-06-06 21:32:21
【问题描述】:

我正在测试我的应用程序并处于 Alpha 模式。我的应用程序获得批准,我可以在 Play 商店中以 alpha 模式找到它。但是,我的应用程序的“磨损”部分不会自动安装到磨损中。

我的穿戴应用目前的功能极少,因此穿戴的“选择加入”一直被拒绝。我仍然希望能够为我的 alpha 用户打包我的最小磨损应用程序,但它似乎不起作用。有什么想法可以让我自动安装应用的磨损部分吗?

这是我目前的文件:

/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>

【问题讨论】:

    标签: android wear-os


    【解决方案1】:

    穿戴应用必须打包在主应用中,不单独分发。您只需像往常一样将移动应用的发布 apk 上传到 Play 商店 alpha 通道。

    两个应用程序必须具有相同的包名称,使用相同的密钥进行签名,并且在移动 gradle 依赖项中,您必须包含可穿戴项目

    wearApp project(':wearable')
    

    有关详细信息,请参阅完整的 Google 文档。 http://developer.android.com/training/wearables/apps/packaging.html

    【讨论】:

    • 我正在做所有这些事情。关于“两个应用程序必须使用相同的密钥签名”......当我:“构建 - > 生成签名的 APK”mobile-relase.apk 时,Gradle 是否已经自动签署了我的穿戴应用程序。 ?
    • 不,那不会在它的磨损部分上签名。您最好不要在 Android Studio 中使用基于 UI 的签名,而是在您的两个 build.gradle 文件中进行签名,这样每次您进行发布构建时,它们都会被签名,然后合并到移动 apk 中。这是一个很好的指南,用于在每次构建时对我的应用程序进行签名。 timroes.de/2013/09/22/handling-signing-configs-with-gradle
    • 谢谢。我成功创建了这些构建文件并将签名放入移动和穿戴中......但它仍然无法正常工作。
    • 要检查的几件事;您是否将上面提到的 wearapp 项目添加到您的 build.gradle 的移动依赖项部分中,您是否刚刚上传了移动 apk,您的 alpha 用户加入了 g+ 社区,并且还使用 play store dev 中提供的链接注册了 alpha控制台你应该给他们,最后你让他们重新同步应用程序?
    • 非常感谢您在这里帮助我,非常感谢。我已经完成了你提到的所有这些事情,但是穿戴应用程序仍然没有下载到他们的穿戴设备上。为了清楚起见,我还将我的文件添加到了这个问题中。
    【解决方案2】:

    我嵌入了导致权限错误的 aar 文件。
    我必须将该 aar 文件中的权限复制到我的移动应用程序中。

    我通过在磨损上使用“adb logcat”解决了这个问题,因为我的 mobile-release.apk 试图从磨损中安装并找出问题所在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-11
      • 1970-01-01
      • 2017-07-07
      • 1970-01-01
      • 2014-10-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多