Already defined the repository variables needed.
This is the Gradle wrapper command in the pipeline
- step:
name: Create Keystores and Google Play API key file
script:
- mkdir keys # create new directory
- echo $DEBUG_KEYSTORE_FILE_BASE64 | base64 -d > keys/$DEBUG_KEYSTORE_FILE # decode base64 then use DEBUG_KEYSTORE_FILE as file name defined in repository variable
- echo $KEYSTORE_FILE_BASE64 | base64 -d > keys/$KEYSTORE_FILE # decode base64 then use KEYSTORE_FILE as file name defined in repository variable
- echo $GOOGLE_PLAY_API_KEY_BASE64 | base64 -d > keys/$GOOGLE_PLAY_API_KEY_FILE # decode base64 then use GOOGLE_PLAY_API_KEY_FILE as file name defined in repository variable
artifacts:
- keys/** # keep these artifacts for subsequent pipeline steps
- 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/
The problem is -PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE
is somewhat being ignored and not working during build.
Build setup5s
chmod +x gradlew<1s
./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:publishFreeReleaseBundle39s
+ ./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:publishFreeReleaseBundle
Downloading https://services.gradle.org/distributions/gradle-7.0-bin.zip
...........................................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n/gradle-7.0-bin.zip to /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n/gradle-7.0/bin/gradle
Welcome to Gradle 7.0!
Here are the highlights of this release:
- File system watching enabled by default
- Support for running with and building Java 16 projects
- Native support for Apple Silicon processors
- Dependency catalog feature preview
For more details see https://docs.gradle.org/7.0/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file '/opt/atlassian/pipelines/agent/build/app/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating project ':app'.
> 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.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 39s
However trying to test it out further I tried to remove -PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION
argument and the error is now on compileSdk
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/opt/atlassian/pipelines/agent/build/app/build.gradle' line: 13
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'ANDROID_BUILD_COMPILED_SDK_VERSION' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
* Get more help at https://help.gradle.org
BUILD FAILED in 39s
With this I assumed that the argument works fine but when it comes to signing it seems that my own signing config is being ignored.
This is the app Gradle file looks like.
android {
compileSdk Integer.parseInt(ANDROID_BUILD_COMPILED_SDK_VERSION)
defaultConfig {
applicationId "com.app.name"
minSdk Integer.parseInt(ANDROID_BUILD_MIN_SDK_VERSION)
targetSdk Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode project.hasProperty('BUILD_NUMBER') ? project['BUILD_NUMBER'].toInteger() : 14
versionName "1.3.3"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
lintOptions {
disable "MissingClass"
}
buildFeatures {
viewBinding true
}
}
play {
serviceAccountCredentials.set(file(GOOGLE_PLAY_API_KEY_FILE))
}
UPDATE: It seems like its not specific to debug signing but also with release I get Could not get unknown property 'APPNAME_KEYSTORE_FILE'
Running it locally on Android Studio terminal works but in pipeline it doesn't work.
from Gradle: Could not get unknown property
No comments:
Post a Comment