android - 如何在Play商店中发布产品口味演示与完整版本

标签 android gradle build android-gradle-plugin apk-expansion-files

我想发布两个APK demo_release.apk和full_release.apk来玩商店

但是我遇到了类似更改应用程序版本代码的错误

如何管理两个不同版本的版本代码

我已经可以通过版本Code 52在play store中使用app_release.apk了。

我想要在Play商店中发布apks演示版和完整版。
但我对它的实际工作方式以及用户如何下载演示版和完整版应用程序感到困惑

这是我的build.gradle文件

apply plugin: 'com.android.application'

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
  }
 }

android {
compileSdkVersion 26
buildToolsVersion '25.0.3'

defaultConfig {
    applicationId "com.credihealth.android"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 52
    versionName "4.2.1.1"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
    }
}

productFlavors {

    demo {
        applicationIdSuffix ".demo"
    }

    full {
        applicationIdSuffix ".full"
    }
}
}

 repositories {
mavenCentral()
flatDir {
    dirs 'libs'
}


    }

dependencies {
compile(name: "youtube_player_api", ext: "jar")
// this line must be included to integrate with Firebase
// this line must be included to use FCM

compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:palette-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.roomorama:caldroid:2.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.uncopt:android.justified:1.0'
compile 'com.yayandroid:LocationManager:2.0.3'
compile 'com.google.android.gms:play-services-plus:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.android.gms:play-services-analytics:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.hbb20:ccp:1.7.6'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.aakira:expandable-layout:1.6.0@aar'
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.stepstone.stepper:material-stepper:3.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
fullCompile 'com.twilio:video-android:1.3.0'
 }

 apply plugin: 'com.google.gms.google-services'

最佳答案

How to manage version codes for two different versions



您可以自定义每种口味的版本代码。
例如:
productFlavors {
    demo {
        applicationIdSuffix ".demo"
        versionCode XX
    }
    full {
        applicationIdSuffix ".full"
        versionCode XX
    }
}

What i want is to release both apks demo and full version in play store. But i am too confused about how it actually works and how the users will be able to download demo and full version of app



它与build.gradle配置无关,取决于您的选择。

关于android - 如何在Play商店中发布产品口味演示与完整版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46173292/

相关文章:

android - Android 平台是否有任何专注于安全性的编码指南?

android - Gradle 复制替换文本并放入同一个文件夹

Groovy 无法解析类,但可以在 groovyconsole 中工作

java - 从 Ant 迁移到Gradle-Macrodef替代品?

hibernate - 具有多个数据库供应商支持的 Java/Maven/JPA/Hibernate 构建的最佳方法?

build - Cmake:如何在构建所有项目文件后运行 add_custom_command()

android - 发送 SMS 的待定 Intent 在发送多条消息时效果不佳

java.lang.RuntimeException : Failure delivering result ResultInfo{who=null, 请求=100,结果=-1,数据= Intent }... : java. lang.NullPointerException

android - java.lang.AssertionError : CALL 'public final fun <get-currentComposer>

visual-studio - 如何衡量开发人员构建时间