如何创建用于发布的 beta 应用程序包?
How to create App bundle for beta for release?
在控制台中,我看到了不同版本的应用程序,但我不太明白如何在 Android Studio 中创建 App Bundle beta
。
例如,我试图以这种方式从 Android Studio 创建:
Build -> Build Bundle(s)/APk -> Build Bundle(s)
问:如何创建测试版?
这是我的代码 build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'idea'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'realm-android'
apply plugin: 'git-repo'
apply from: './jacoco.gradle'
apply from: "./common-methods.gradle"
android {
signingConfigs {
release
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.properties'
exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.xml'
}
dexOptions {
javaMaxHeapSize "2048m"
jumboMode = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
defaultConfig {
applicationId "com.sai.android"
testApplicationId "com.sai.android.tests"
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
buildToolsVersion '30.0.2'
minSdkVersion 19
compileSdkVersion 30
targetSdkVersion 30
versionCode 209
versionName '2.12.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
lintOptions {
disable 'MissingTranslation' // google services plugin is causing missing translation issue
}
testCoverageEnabled false
}
debug {
debuggable true
lintOptions {
disable 'MissingTranslation' // google services plugin is causing missing translation issue
}
testCoverageEnabled true
// applicationIdSuffix ".debug"
}
}
flavorDimensions "default"
productFlavors {
production {
dimension "default"
}
staging {
dimension "default"
}
acceptance {
dimension "default"
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
bundle {
language {
// Specifies that the app bundle should not support configuration APKs for language resources.
// These resources are instead packaged with each base and dynamic feature APK.
enableSplit = false
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:29.0.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':rasp')
implementation 'com.saltedge.android.common:views-lib:0.1.8.1@aar'
implementation 'com.saltedge.android.common:tools-lib:0.1.4@aar'
implementation 'com.saltedge.android.common:models-lib:0.1.3@aar'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.work:work-runtime-ktx:2.5.0"
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation('com.twitter.sdk.android:twitter:3.3.0@aar') {
transitive = true
}
implementation 'com.tubb.smrv:swipemenu-recyclerview:5.4.8'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.yandex.android:mobmetricalib:3.2.2'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
implementation 'net.danlew:android.joda:2.10.2'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation('com.theartofdev.edmodo:android-image-cropper:2.8.0') {
exclude group: "com.android.support"
}
implementation 'net.objecthunter:exp4j:0.4.8'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation ("com.github.bumptech.glide:glide:4.11.0") {
exclude group: "com.android.support"
}
implementation 'com.caverock:androidsvg:1.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation('androidx.multidex:multidex-instrumentation:2.0.0') {
exclude group: 'com.android.support', module: 'multidex'
}
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation('androidx.test.espresso:espresso-idling-resource:3.1.0', {
exclude module: 'support-annotations'
})
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
})
androidTestImplementation 'org.hamcrest:hamcrest-core:2.2'
androidTestImplementation 'org.hamcrest:hamcrest-integration:1.3'
androidTestImplementation 'org.hamcrest:hamcrest-library:2.2'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
androidTestImplementation 'org.mockito:mockito-android:3.2.4'
testImplementation 'org.mockito:mockito-core:3.3.3'
}
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
repositories {
mavenCentral()
maven { url "http://dl.bintray.com/glomadrian/maven" }
androidCommonGit("https://git.saltedge.com/shared/android-common.git")
}
setupSigning("./signing.properties", "release")
apply plugin: 'com.google.gms.google-services'
在您的 gradle 文件中指定 versionName 这里是 docs
您在屏幕截图中显示的版本名称全部来自应用模块 build.gradle
文件中的 versionName
属性。您将应用放在哪个 Google Play 商店发布渠道并不重要。您的 APK / AAB 的版本名称没有改变。
如果要创建带有 -beta
后缀的版本,则需要将其实际添加到版本名称值中并创建 APK / AAB。
Google Play 商店允许您指定自己的版本名称,该名称将显示在商品详情中。您可以在创建发布时执行此操作。但不会影响实际打包的APK/AAB版本名称。
根据风格或构建类型自动更改版本名称
然而,可以根据风格和/或构建类型自动更改 versionName
(和 applicationId
)。您可以使用 versionNameSuffix
为版本名称添加后缀。例如,如果您想轻松区分您在示例中列出的生产、暂存和验收测试版本,这是有意义的。
android{
...
flavorDimensions "default"
productFlavors {
production {
dimension "default"
}
staging {
dimension "default"
versionNameSuffix "-staging"
}
acceptance {
dimension "default"
versionNameSuffix "-acceptance"
}
}
}
在控制台中,我看到了不同版本的应用程序,但我不太明白如何在 Android Studio 中创建 App Bundle beta
。
例如,我试图以这种方式从 Android Studio 创建:
Build -> Build Bundle(s)/APk -> Build Bundle(s)
问:如何创建测试版?
这是我的代码 build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'idea'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'realm-android'
apply plugin: 'git-repo'
apply from: './jacoco.gradle'
apply from: "./common-methods.gradle"
android {
signingConfigs {
release
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.properties'
exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.xml'
}
dexOptions {
javaMaxHeapSize "2048m"
jumboMode = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
defaultConfig {
applicationId "com.sai.android"
testApplicationId "com.sai.android.tests"
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
buildToolsVersion '30.0.2'
minSdkVersion 19
compileSdkVersion 30
targetSdkVersion 30
versionCode 209
versionName '2.12.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
lintOptions {
disable 'MissingTranslation' // google services plugin is causing missing translation issue
}
testCoverageEnabled false
}
debug {
debuggable true
lintOptions {
disable 'MissingTranslation' // google services plugin is causing missing translation issue
}
testCoverageEnabled true
// applicationIdSuffix ".debug"
}
}
flavorDimensions "default"
productFlavors {
production {
dimension "default"
}
staging {
dimension "default"
}
acceptance {
dimension "default"
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
bundle {
language {
// Specifies that the app bundle should not support configuration APKs for language resources.
// These resources are instead packaged with each base and dynamic feature APK.
enableSplit = false
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:29.0.0'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':rasp')
implementation 'com.saltedge.android.common:views-lib:0.1.8.1@aar'
implementation 'com.saltedge.android.common:tools-lib:0.1.4@aar'
implementation 'com.saltedge.android.common:models-lib:0.1.3@aar'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.work:work-runtime-ktx:2.5.0"
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation('com.twitter.sdk.android:twitter:3.3.0@aar') {
transitive = true
}
implementation 'com.tubb.smrv:swipemenu-recyclerview:5.4.8'
implementation 'org.greenrobot:eventbus:3.2.0'
implementation 'com.yandex.android:mobmetricalib:3.2.2'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
implementation 'net.danlew:android.joda:2.10.2'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation('com.theartofdev.edmodo:android-image-cropper:2.8.0') {
exclude group: "com.android.support"
}
implementation 'net.objecthunter:exp4j:0.4.8'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation ("com.github.bumptech.glide:glide:4.11.0") {
exclude group: "com.android.support"
}
implementation 'com.caverock:androidsvg:1.4'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation('androidx.multidex:multidex-instrumentation:2.0.0') {
exclude group: 'com.android.support', module: 'multidex'
}
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.3.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation('androidx.test.espresso:espresso-idling-resource:3.1.0', {
exclude module: 'support-annotations'
})
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
})
androidTestImplementation 'org.hamcrest:hamcrest-core:2.2'
androidTestImplementation 'org.hamcrest:hamcrest-integration:1.3'
androidTestImplementation 'org.hamcrest:hamcrest-library:2.2'
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
androidTestImplementation 'org.mockito:mockito-android:3.2.4'
testImplementation 'org.mockito:mockito-core:3.3.3'
}
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
repositories {
mavenCentral()
maven { url "http://dl.bintray.com/glomadrian/maven" }
androidCommonGit("https://git.saltedge.com/shared/android-common.git")
}
setupSigning("./signing.properties", "release")
apply plugin: 'com.google.gms.google-services'
在您的 gradle 文件中指定 versionName 这里是 docs
您在屏幕截图中显示的版本名称全部来自应用模块 build.gradle
文件中的 versionName
属性。您将应用放在哪个 Google Play 商店发布渠道并不重要。您的 APK / AAB 的版本名称没有改变。
如果要创建带有 -beta
后缀的版本,则需要将其实际添加到版本名称值中并创建 APK / AAB。
Google Play 商店允许您指定自己的版本名称,该名称将显示在商品详情中。您可以在创建发布时执行此操作。但不会影响实际打包的APK/AAB版本名称。
根据风格或构建类型自动更改版本名称
然而,可以根据风格和/或构建类型自动更改 versionName
(和 applicationId
)。您可以使用 versionNameSuffix
为版本名称添加后缀。例如,如果您想轻松区分您在示例中列出的生产、暂存和验收测试版本,这是有意义的。
android{
...
flavorDimensions "default"
productFlavors {
production {
dimension "default"
}
staging {
dimension "default"
versionNameSuffix "-staging"
}
acceptance {
dimension "default"
versionNameSuffix "-acceptance"
}
}
}