Android 使用flavor variant发布付费应用程序
我想发布付费应用和免费应用 我用这个代码创建了免费和付费的风格Android 使用flavor variant发布付费应用程序,android,Android,我想发布付费应用和免费应用 我用这个代码创建了免费和付费的风格 productFlavors { free { applicationId "com.example.myapp.free" versionName "1.0-free" // this boolean can be accessed in java classes by using BuildConfig class // and now you can i
productFlavors {
free {
applicationId "com.example.myapp.free"
versionName "1.0-free"
// this boolean can be accessed in java classes by using BuildConfig class
// and now you can identify if your app is the paid version or not
buildConfigField "boolean", "PAID_VERSION", "false"
}
paid {
applicationId "com.example.myapp.paid"
versionName "1.0-paid"
buildConfigField "boolean", "PAID_VERSION", "true"
}
}
我想知道如何上传这个应用程序
我们需要两个不同的apk(付费释放apk和免费apk)
还是单apk
我需要在playstore中提供这两种变体您获得了如图所示的这种类型的构建变体:在您的示例中,您可以看到paidDebug和freeDebug选项 如果要发布付费版本,则必须选择paidDebug;如果要发布免费版本,则必须选择freeDebug
您得到了如图所示的这种类型的构建变量:在您的例子中,您可以看到paidDebug和freeDebug选项 如果要发布付费版本,则必须选择paidDebug;如果要发布免费版本,则必须选择freeDebug
如果您有两种口味变体 像
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
}
}
如果你有两种口味 像
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
}
}
谢谢,在你说的改变之后。。。我们只需要一个付费的apk上传???/谢谢,在你说的更改之后。。。我们只需要一个付费的apk上传???/制作签名apk需要哪种模式和版本。。freedebeug orer paid deug???制作标志apk需要哪种模式和版本。。弗里德贝格·奥勒付了多少钱???