我使用以下格式创建了两种app应用程序
defaultConfig {
applicationId "com.example.myapp"
}
productFlavors
{
free {
versionName "1.0-free"
buildConfigField "boolean", "PAID_VERSION", "false"
buildConfigField "String", "BuildType", "Free"
}
paid {
versionName "1.0-paid"
buildConfigField "boolean", "PAID_VERSION", "true"
buildConfigField "String", "BuildType", "Paid"
}
}
并在java中使用像这样的
public void manageFeaturesWithBuildType()
{
String buildType = BuildConfig.BuildType;
if(buildType.equals("Paid"))
{
//Here Enable or Disable your features for paid Build
}
else
{
//Here Enable or Disable your features for free Build
}
}
现在我为free-relese.apk和paid-release.apk创建了一个签名的apk 我想在playstore上发布它 我想把它作为付费和免费版本
我怎么发表呢? 我是否需要发布付费发布的apk或free-release.apk或两者兼而有之?
答案 0 :(得分:1)
如果您希望将付费版本与免费版本分开,则需要为每种口味指定两种不同的applicationId
。
free {
applicationId "com.example.myapp.free"
}
&安培;
paid {
applicationId "com.example.myapp.paid"
}
或者您可以使用applicationIdSuffix ".free"
进行简化,并从风格中删除applicationId