Android Pipeline signing configuration issue
Asked by Ahmed Aly:

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."
```


Answers:
author: Theodora Boudale
body: 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:

* <https://confluence.atlassian.com/bbkb/troubleshoot-failed-bitbucket-pipelines-locally-with-docker-1318882094.html>

Kind regards,  
Theodora

comments: author: Ahmed Aly
body: 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


author: Ahmed Aly
body: the file is already exist in the repo inside the app folder of the Android project


author: Theodora Boudale
body: 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?

* <https://confluence.atlassian.com/bbkb/troubleshoot-failed-bitbucket-pipelines-locally-with-docker-1318882094.html>

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

Kind regards,  
Theodora


author: Ahmed Aly
body: After I check My file I found that the file name is not correct after correct it it works fine


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


Tags: bitbucket-cloud

cloud