Android Pipeline signing configuration issue

Ahmed Aly May 30, 2024

I got

> Keystore file '/opt/atlassian/pipelines/agent/build/app/keyStore.jks' not found for signing config 'release '.
224
I have 4 variants and I need to build  release and debug apk for all variants

that is my script 

 

image: mingc/android-build-box:latest

pipelines:
branches:
development:
- step:
name: "Build [DEBUG] and run Unit Tests"
script:
- echo "START script build-debug.sh"
- chmod +x build-debug.sh
- ./build-debug.sh
- echo "END script build-debug.sh - artifacts we [DEBUG] build can be downloaded..."
- pipe: atlassian/bitbucket-upload-file:0.7.1
variables:
BITBUCKET_ACCESS_TOKEN: $BITBUCKET_ACCESS_TOKEN
FILENAME: "./app/build/outputs/apk/debug/app-debug.apk"
FILE_PATH: "artifacts/app-debug.apk"


 and that is build-debug.sh
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Define some colors for better readability in logs
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

# Function to print messages in green color
function echo_green() {
echo -e "${GREEN}$1${NC}"
}

# Function to print messages in red color
function echo_red() {
echo -e "${RED}$1${NC}"
}

# Start the build process
echo_green "Starting the build process..."
chmod +x gradlew

# Clean the project
echo_green "Cleaning the project..."
./gradlew clean

# Assemble the debug build
echo_green "Assembling the debug build..."
./gradlew build

cd ./app/build/outputs/apk/debug
ls -la
# Notify completion of the build process
echo_green "Build process completed successfully."

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2024

Hi Ahmed and welcome to the community!

The error indicates that the build cannot find a certain file in the path /opt/atlassian/pipelines/agent/build/app/. Does the file exist in that directory?

Just to give you some context, Pipelines builds run in Docker containers. For every step of your build, a Docker container starts (the build container) using the image you have specified in your bitbucket-pipelines.yml file. The repo is cloned in the build container in the directory /opt/atlassian/pipelines/agent/build (this is the clone directory).

Does this file exist in your repo in the directory named app? Or are you downloading it during the build in that directory?

I suggest debugging this build locally with Docker first, and when you have a build that runs locally, it should work in Pipelines as well. You can follow this guide to debug the build locally with Docker:

Kind regards,
Theodora

Ahmed Aly June 2, 2024

I don't have this path "/opt/atlassian/pipelines/agent/build/app/" to add a file to it 

I need to add keystore.jks, key alias, and password to be used in singing for builds

 

Ahmed Aly June 2, 2024

 the file is already exist  in the repo inside the app folder of the Android project

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 3, 2024

Hi Ahmed,

The path /opt/atlassian/pipelines/agent/build/app/ is not a path on your repository. The path /opt/atlassian/pipelines/agent/build/ is a directory in the Docker container where your build runs during a Pipelines build. In that directory, your repo gets cloned, and the commands of your yml file get executed.

Did you try debugging the build locally as per the guide I shared in my previous reply?

What happens when you debug the build locally as per this guide?

Kind regards,
Theodora

Ahmed Aly June 8, 2024

After I check My file I found that the file name is not correct after correct it it works fine 

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 10, 2024

That's good to hear, thank you for the update! Please feel free to reach out if you ever need anything else.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events