【问题标题】:Multiple APKs in Release多个 APK 正在发布
【发布时间】:2017-09-03 15:54:57
【问题描述】:

上下文

我最近完成了一个同时使用 Android Wear 和移动设备的宠物项目应用程序的发布阶段。我已将它作为 Alpha 版本上传到 Play 开发者控制台,Wear 部分也获得了批准,但在查看商品详情时,兼容性概览显示为好像只提供了移动 APK。

我已尝试通过以下一些提示使其识别这两个版本:

  • 确保<uses-permission> 元素在两者中相同
  • 配置 Gradle 以使用相同的密钥进行签名(即使我使用了 Android Studio 的“生成签名的 APK”选项)
  • 通过注释掉 Gradlefile 中的 wearApp 声明来拆分 APK

开发人员文档说我需要在“APK 文件页面”上启用“高级模式”,但由于控制台已转换为发布管理器,我认为不再是一个选项,它只接受一个 APK,手机或 Wear,但不能两者兼有。 在测试期间,Wear 设备自然可以毫无问题地运行 APK,无论是在调试模式还是即时运行模式下,甚至从菜单中(无需 ADB 连接)。

问题

  • 为什么当“组合”APK(默认情况下,Android Studio 将 Wear APK 嵌入到移动 APK 中,这应该不会导致问题时,Play 商店只显示兼容的移动设备? Android Wear 2.0)已上传
  • 如何将两个 APK 附加到一个版本(无论是否为 alpha 版本),以便两者都显示在列表中?
  • 如果需要,我如何从 Studio 打包 APK 以实现相同的效果?

参考文件

wear.build

apply plugin: 'com.android.application'

android {
    lintOptions {
        disable 'MissingTranslation'
    }

    compileSdkVersion 25

    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "tech.provingground.divemonitor"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 6
        versionName "1.0.0-remote"
    }

    signingConfigs {
        release {
            storeFile file("[path/to/file]")
            storePassword "[redacted]"
            keyAlias "mobile keystore"
            keyPassword "[redacted]"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    provided 'com.google.android.wearable:wearable:2.0.0'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.google.android.support:wearable:2.0.0'
    compile 'com.google.android.gms:play-services-wearable:10.2.1'
    // https://mvnrepository.com/artifact/commons-io/commons-io
    compile 'commons-io:commons-io:2.5'
    compile project(':commons')
}

mobile.build

apply plugin: 'com.android.application'

android {
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    lintOptions {
        disable 'MissingTranslation'
    }

    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "tech.provingground.divemonitor"
        minSdkVersion 24
        targetSdkVersion 25
        versionCode 6
        versionName "1.0.0-local"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            storeFile file("[path/to/file]")
            storePassword "[redacted]"
            keyAlias "mobile keystore"
            keyPassword "[redacted]"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    wearApp project(':wear')
    // https://mvnrepository.com/artifact/commons-io/commons-io
    compile project(':commons')
    compile 'com.google.android.gms:play-services-wearable:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'commons-io:commons-io:2.5'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr2'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-csv
    compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.9.0.pr2'
    testCompile 'junit:junit:4.12'
}

【问题讨论】:

    标签: android android-studio google-play apk wear-os


    【解决方案1】:

    确保两个 APK 的 versionCode 属性不同。只有这样它们才能共存。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-07
      • 2020-04-22
      • 2017-07-22
      相关资源
      最近更新 更多