'Flutter & Github Actions: Create unsigned APK (Execution failed for task ':app:validateSigningRelease')
I am using GitHub actions to build my Flutter APK for testing purposes. Recently I built and signed my app and released it to Google Play, however, by doing this I broke my GitHub Action.
I get this error now when my action runs:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
This is the action:
name: APK
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v1
- run: flutter pub get
- run: flutter test
- run: flutter build apk --no-tree-shake-icons
- run: flutter build appbundle --no-tree-shake-icons
- run: sudo chown -R $USER:$GROUP ~
- uses: actions/upload-artifact@v2
with:
name: apk
path: build/app/outputs/flutter-apk/app-release.apk
So I guess there are two ways to solve this and I'd like to have an answer to both:
- How can I continue to build unsigned APKs with GitHub Actions?
- How can I build an actual signed APK ready for release with GitHub Actions?
Keep in mind that building locally works fine (because all required files are present locally to build a signed APK).
Edit #01:
My build.gradle looks like this:
...
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "at.test.app"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
