Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket Pipeline Gradle : Could not get unknown property

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

1 answer

1 accepted

0 votes
Answer accepted

The problem was the spacing in gradlew command.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

110 views 0 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you