通过 Google Beta 测试管理指向暂存服务器和生产的 APK

Managing APK pointing to staging server & production via Google Beta Testing

通过 Google Play 商店 Beta 测试平台管理 APK 指向暂存和生产的测试的最佳做法是什么?

您通常有一个完全独立的应用程序列表和指向暂存的构建,如果是这样,您将如何处理不同的签名证书?

或者您是否通过 Alpha 和 Beta 渠道管理一切?

我通常不使用 Google Play Beta,但经常用 Gradle 改变 staging/production/development 情况。

像下面这样编写您的应用 gradle。

配置

configurations {
    stagingDebugCompile
    stagingReleaseCompile

    productionDebugCompile
    productionReleaseCompile

    developmentDebugCompile
    developmentReleaseCompile
}

签署配置

signingConfigs {
    def releaseSettingGradleFile = new File("${project.rootDir}/release.gradle")
    if (releaseSettingGradleFile.exists()) {
        apply from: releaseSettingGradleFile, to: android
    } else {
        release {
            def debugSettingGradleFile = new File("${project.rootDir}/debug.gradle")
            apply from: debugSettingGradleFile, to: android
        }
    }

    def debugSettingGradleFile = new File("${project.rootDir}/debug.gradle")
    debug {
        apply from: debugSettingGradleFile, to: android
    }
}

构建类型

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
    debug {
        signingConfig signingConfigs.debug
    }
}

产品风味

productFlavors {
    staging {
    }
    production {
    }
    development {
    }
}

不要忘记放入 release.gradle 和 debug.gradle 文件。 debug.gradle 可能是这样的。

signingConfigs {                                                                                                                                              
    debug {
        def HOME = System.getProperty("user.home")
        storeFile file("${HOME}/.android/debug.keystore")
        storePassword "android"
        keyAlias "androiddebugkey"
        keyPassword "android"
    }
}