I tried to pass some parameters using -P in Gradle task, I tried it locally in Android Studio terminal and it works. However doing this in BB Pipelines fails as it does not recognize other parameters.
This is how the gradle build looks like
signingConfigs {
debug {
storeFile file(DEBUG_KEYSTORE_FILE)
storePassword DEBUG_KEYSTORE_PASSWORD
keyAlias DEBUG_KEYSTORE_KEY_ALIAS
keyPassword DEBUG_KEYSTORE_KEY_PASSWORD
}
release {
storeFile file(APPNAME_KEYSTORE_FILE)
storePassword APPNAME_KEYSTORE_PASSWORD
keyAlias APPNAME_KEYSTORE_KEY_ALIAS
keyPassword APPNAME_KEYSTORE_KEY_PASSWORD
}
}
buildTypes {
debug {
debuggable true
minifyEnabled true
shrinkResources true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
release {
debuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
The pipeline step with repository variable as the parameters value.
- step:
name: Build & Deploy (Internal)
caches: # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
- gradle
script:
# publish the aab file to the internal testing channel
# the plugin publishes to the internal testing track by default
- chmod +x gradlew
- "./gradlew
-PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION
-PANDROID_BUILD_MIN_SDK_VERSION=$ANDROID_BUILD_MIN_SDK_VERSION
-PANDROID_BUILD_TARGET_SDK_VERSION=$ANDROID_BUILD_TARGET_SDK_VERSION
-PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE
-PDEBUG_KEYSTORE_PASSWORD=$DEBUG_PASSWORD
-PDEBUG_KEYSTORE_KEY_ALIAS=$DEBUG_KEY_ALIAS
-PDEBUG_KEYSTORE_KEY_PASSWORD=$DEBUG_KEY_PASSWORD
-PAPPNAME_KEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PAPPNAME_KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PAPPNAME_KEY_ALIAS=$KEYSTORE_KEY_ALIAS
-PAPPNAME_KEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
clean :app:publishReleaseBundle"
artifacts:
- app/build/outputs/ # artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/
Here, the pipelines fails reading `-PDEBUG_KEYSTORE_FILE` even '-PAPPNAME_KEYSTORE_FILE'
> Could not get unknown property 'DEBUG_KEYSTORE_FILE' for SigningConfig_Decorated{name=debug, storeFile=/opt/android-sdk-linux/.android/debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null} of type com.android.build.gradle.internal.dsl.SigningConfig.
> Could not get unknown property 'APPNAME_KEYSTORE_FILE' for SigningConfig_Decorated{name=release, storeFile=null, storePassword=null, keyAlias=null, keyPassword=null, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null} of type com.android.build.gradle.internal.dsl.SigningConfig.
I do not know where the problem could come from since the Gradle task command works fine locally.
Full detail:
https://stackoverflow.com/q/68218878/12204620
The problem was the spacing in gradlew command.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.