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

How to correctly sign android build via bitbucket pipelines?

Oleksandr Sorochynskyi October 25, 2022

Hello.

I have the bitbucket pipeline for android builds, but can't sign my apk.

 

 - step:

    name: Build android

    image: android-30

    script:

      - echo $DEBUG_KEYSTORE_FILE_BASE64 | base64 -d > android-signing-keystore.jks

      - ./gradlew -SIGNING_JKS_FILE=android-signing-keystore.jks

                   -KEYSTORE_PASSWORD=$SIGNING_KEYSTORE_PASSWORD

                   -KEY_ALIAS=$SIGNING_KEY_ALIAS

                   -KEY_PASSWORD=$SIGNING_KEY_PASSWORD

                   :app:assembleTestReleas

 

In build.gradle I've added:

 signingConfigs {

   release {

     storeFile file(SIGNING_JKS_FILE)

     storePassword KEYSTORE_PASSWORD

     keyAlias KEY_ALIAS

     keyPassword SKEY_PASSWORD

   }

}


But got the error:

Unknown command-line option '-K'.

How correctly sign android build via pipeline?

1 answer

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 25, 2022

Try replacing  

- ./gradlew ...

with 

- > ./gradlew ...
Oleksandr Sorochynskyi October 25, 2022

In this case I'm getting invalid pipelines file

Minh Tan November 28, 2022

@Oleksandr Sorochynskyi  do you resolve the issue ? and how did you do it?

Oleksandr Sorochynskyi November 28, 2022

@Minh TanYes, I've solved.

Looks like:

 - echo $DEBUG_KEYSTORE_FILE_BASE64 | base64 -d > app/android-signing-keystore.jks

- ./gradlew -PKEYSTORE_FILE=android-signing-keystore.jks

-PKEYSTORE_PASSWORD=$SIGNING_KEYSTORE_PASSWORD

-PKEY_ALIAS=$SIGNING_KEY_ALIAS

-PKEY_PASSWORD=$SIGNING_KEY_PASSWORD

:app:assemble"$BITBUCKET_BRANCH"Release


And variables have names:

DEBUG_KEYSTORE_FILE_BASE64
SIGNING_KEYSTORE_PASSWORD
SIGNING_KEY_ALIAS
SIGNING_KEY_PASSWORD

Oleksandr Sorochynskyi November 28, 2022

And in a file build.gradle I've added:

 signingConfigs {

release {

if (project.hasProperty('KEYSTORE_FILE')) {

storeFile file(KEYSTORE_FILE)

storePassword KEYSTORE_PASSWORD

keyAlias KEY_ALIAS

keyPassword KEY_PASSWORD

}

}

}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events