From 7d3a99d15ba024b4bde9e698e57937002da38bd4 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 01cb5884b..de9057df1 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 9ac2ae59a..187bf280c 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -174,6 +174,7 @@ export function runProgram(config: Config): void { platform, { scheme, + flavor, keystorepath, keystorepass, keystorealias, @@ -185,6 +186,7 @@ export function runProgram(config: Config): void { const { buildCommand } = await import('./tasks/build'); await buildCommand(config, platform, { scheme, + flavor, keystorepath, keystorepass, keystorealias,