Android Gradle - 如何检查productFlavour是否为调试版或发行版

时间:2014-11-03 11:28:41

标签: android mobile ant build gradle

我有一个调试和发布版本类型。我也使用带有不同配置的productFlavour。现在如何检查productFlavour,如果是调试版本或发布版本?

signingConfigs {

        release {
            keyAlias '*****'
            keyPassword '****'
            storePassword '*****'
            storeFile file('./config/keystore/Android***ReleaseKeyStore')

        }

        unsigned{

        }
    }

    buildTypes {

        debug{
            runProguard false
            buildConfigField "String", "ID", "\"00000\""
            debuggable true**
        }

        release {

            runProguard true
            proguardFiles 'proguard-project.txt'
            signingConfig signingConfigs.release
            zipAlign true
            debuggable false
        }
    }

    productFlavors {
        b2c {
            applicationId 'com.foo.bar'
            buildConfigField "String", "ID", "\"11111\""

            if(debuggable){
                  buildConfigField "String", "ID", "\"22222\""
            }
        }

...

0 个答案:

没有答案