Android - flutter-build step tries to sign and fails

Hi all,
I’m trying to create an android build from a flutter project. During the Flutter-Build step, it attempts to sign the code and fails on “Keystore file not set for signing config release”. I’d rather use Sign Apk step to sign the build anyway, but Flutter-Build step already fails. I added a File Download step and still get the “keystore not set…” Error.

Anyone got ideas on what I’m misconfiguring? many Thanks.

    Initializing gradle...                                             13.3s
    Resolving dependencies...                                          40.3s
    Running Gradle task 'assembleRelease'...                        
    Calling mockable JAR artifact transform to create file: /Users/vagrant/.gradle/caches/transforms-1/files-1.1/android.jar/ced065ce0b40d5d5b8f059882c438a19/android.jar with input /usr/local/share/android-sdk/platforms/android-28/android.jar
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':app:validateSigningRelease'.
    > Keystore file not set for signing config release
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    * Get more help at https://help.gradle.org
    BUILD FAILED in 1m 50s
    Running Gradle task 'assembleRelease'...                          112.2s
    Gradle task assembleRelease failed with exit code 1
    Failed to build Android platform, error: exit status 1

My android/app/build.gradle is like this

        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
            debug {
                signingConfig signingConfigs.debug
            }
        }
        signingConfigs {
            release {
                keyAlias System.getenv("BITRISEIO_ANDROID_KEYSTORE_ALIAS")
                keyPassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
                storeFile file(System.getenv("HOME") + "/keystores/pong-release.jks")
                storePassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PASSWORD")
            }
            debug {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                storePassword keystoreProperties['storePassword']
            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
            debug {
                signingConfig signingConfigs.debug
            }
        }

This is my workflow. I tried to insert “–nocodesign” into the android_additional_params to no avail : “cannot find target file “–nocodesign””

primary-android-only:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.17: {}
    - script@1.1.5:
        title: Do anything with Script step
    - flutter-installer@0.11.0:
        inputs:
        - is_update: 'false'
    - cache-pull@2.1.1: {}
    - flutter-analyze@0.1.2:
        inputs:
        - project_location: "$BITRISE_FLUTTER_PROJECT_LOCATION"
    - file-downloader@1.0.1:
        inputs:
        - destination: file://$HOME/keystores/pong-release.keystore
        - source: "$BITRISEIO_ANDROID_KEYSTORE_URL"
    - flutter-build@0.12.0:
        inputs:
        - project_location: "$BITRISE_FLUTTER_PROJECT_LOCATION"
        - platform: android
        - android_additional_params: "--release -t lib/app.dart"
    - sign-apk@1.4.2: {}
    - flutter-test@0.9.1: {}
    - deploy-to-bitrise-io@1.9.2:
        inputs:
        - notify_email_list: "$EMAILS_TO_NOTIFY"
    - cache-push@2.2.1: {}

File extensions don’t match: keystore vs jks

Thanks Koral, I’ve fixed the mismatch but still getting the same error

* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release

is build-flutter supposed to try to sign? or, is there any way to disable app:validateSigningRelease during the step?

I removed the signing info for release, so my android/app/build.gradle now looks like

signingConfigs {
        debug {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }

now running flutter build apk --release -t lib/app.dart locally passes

$ flutter build apk --release -t lib/app.dart
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK
size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
[!] Your app isn't using AndroidX.
    To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      14.0s
✓ Built build/app/outputs/apk/release/app-release.apk (17.0MB).

but running flutter-build on bitrise still causes Keystore file not set for signing config release

tried to move the keystore download to
/Users/vagrant/git/android/app/pong-release.keystore’
instead of
/Users/vagrant/keystores/pong-release.keystore
but no dice…

I want to point out that if the keysore is simply not found it should error out as
Keystore file <path> not found for signing config 'release'.
(from https://stackoverflow.com/questions/52432885/how-create-keystore-for-release-and-not-on-debug-flutter)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.