Open6

BitriseでFlutter CI/CDのメモ

hndrhndr

ビルド番号自動付与

https://devcenter.bitrise.io/jp/builds/build-numbering-and-app-versioning/
https://flutter.dev/docs/deployment/ios#updating-the-apps-version-number
https://flutter.dev/docs/deployment/android#updating-the-apps-version-number
https://github.com/flutter/flutter/issues/23811#issuecomment-673738078

iOS

https://recolog.winterer.app/20190228/
https://qiita.com/kenkono/items/e5a2be486840bb07b86c

Android

https://backport.net/blog/2019/09/01/flutter_android_app_version/
https://developer.android.com/studio/publish/versioning
https://qiita.com/zb185423/items/2a7b49c32b817049cf2d
https://qiita.com/kenkono/items/6b0f6d8634b0a6cbaf4e
https://www.bitrise.io/integrations/steps/change-android-versioncode-and-versionname

android側は Change Android versionCode and versionName Stepの利用だと
pubspec.yaml から上書きされてしまってうまくいかない
Get pubspec version and build number Stepで
$PUBSPEC_VERSION_NAME $PUBSPEC_VERSION_NUMBER を格納できるためこちらを利用したり$BITRISE_BUILD_NUMBER やコマンドと組み合わせればいけそう。

flutter build apk --build-name=$PUBSPEC_VERSION_NAME --build-number=$BITRISE_BUILD_NUMBER
hndrhndr

iOS FirestoreのBuild短縮

https://firebase.flutter.dev/docs/overview/#improve-ios-build-times
https://note.com/morita_kento/n/n783643698d82

Unsupported Android Plugin version

Running Gradle task 'assembleRelease'...                          581.7s
Unsupported Android Plugin version: 3.5.4.
Failed to build Android platform, error: exit status 1

https://discuss.bitrise.io/t/unsuported-android-plugin-version-3-6-1/12375
https://github.com/flutter/flutter/blob/25ba467b5a9bf1a3a9c84ca70d7c807ac4da5200/packages/flutter_tools/lib/src/android/gradle_utils.dart#L144

3.5.1-3.99 間がサポートされていない?ようだったので android/build.gradle 内を 3.5.0 に落として修正した。

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
    }
}