2016-09-14 13 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" 
    } 
}