2016-09-14 11 views

回答

2

我通常不会使用Google Play Beta,但通常会使用Gradle更改分段/生产/开发情况。

在下面写下你的应用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" 
    } 
}