Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,355
Community Members
 
Community Events
165
Community Groups

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
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,229 views 2 9
Read article

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