From c9032c20989ba45284c75ec4e0132a60c6ace9ac Mon Sep 17 00:00:00 2001 From: Ryan Bosher Date: Fri, 19 Jan 2024 05:32:24 +1300 Subject: [PATCH] fix(cli): correctly build and sign Android apps using Flavors (#7082) Co-authored-by: Mark Anderson Co-authored-by: jcesarmobile --- cli/src/android/build.ts | 16 ++++++++++++---- cli/src/index.ts | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cli/src/android/build.ts b/cli/src/android/build.ts index 73c31ebf6f..b2fa82cfc8 100644 --- a/cli/src/android/build.ts +++ b/cli/src/android/build.ts @@ -35,17 +35,25 @@ export async function buildAndroid( } } + const releaseDir = releaseTypeIsAAB + ? flavor !== '' + ? `${flavor}Release` + : 'Release' + : flavor !== '' + ? join(flavor, 'release') + : 'release'; + const releasePath = join( config.android.appDirAbs, 'build', 'outputs', releaseTypeIsAAB ? 'bundle' : 'apk', - buildOptions.flavor ? `${flavor}Release` : 'release', + releaseDir, ); - const unsignedReleaseName = `app${ - config.android.flavor ? `-${config.android.flavor}` : '' - }-release${releaseTypeIsAAB ? '' : '-unsigned'}.${releaseType.toLowerCase()}`; + const unsignedReleaseName = `app${flavor !== '' ? `-${flavor}` : ''}-release${ + releaseTypeIsAAB ? '' : '-unsigned' + }.${releaseType.toLowerCase()}`; const signedReleaseName = unsignedReleaseName.replace( `-release${ diff --git a/cli/src/index.ts b/cli/src/index.ts index f358b6fe52..3a887801de 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -169,6 +169,7 @@ export function runProgram(config: Config): void { platform, { scheme, + flavor, keystorepath, keystorepass, keystorealias, @@ -180,6 +181,7 @@ export function runProgram(config: Config): void { const { buildCommand } = await import('./tasks/build'); await buildCommand(config, platform, { scheme, + flavor, keystorepath, keystorepass, keystorealias,