Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 根据productFlavor设置applicationIdSuffix_Android_Gradle_Build.gradle - Fatal编程技术网

Android 根据productFlavor设置applicationIdSuffix

Android 根据productFlavor设置applicationIdSuffix,android,gradle,build.gradle,Android,Gradle,Build.gradle,我们有2种productFlavors(testServer、liveServer)和2种构建类型(debug、release) 由于现有的API键,我必须基于buildType+productFlavor追加包名 例如: buildTypes { debug { applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live') } release { applicationidSuffix '' + (test

我们有2种
productFlavors
(testServer、liveServer)和2种构建类型(debug、release)

由于现有的API键,我必须基于buildType+productFlavor追加包名

例如:

buildTypes {
  debug {
   applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live')
  }

  release {
   applicationidSuffix '' + (testServer ? '.test')
  }  
}
这可能吗?怎么做

productFlavors {
    testServer {
        applicationId = "com.example.my.pkg.test"
    }
    liveServer {
        applicationId = "com.example.my.pkg.live"
    }
}

buildTypes {
    debug {
        applicationIdSuffix ".debug"
    }
}
有关更多信息,请查看有关应用程序ID的