matteoh
matteoh

Reputation: 3570

How to init Fastlane for a multi-flavor Flutter app?

I'm working on a Flutter app targeting both iOS and Android, and I use Codemagic for my CI.

Since Codemagic doesn't provide any native feature to automatically upload the screenshots to the stores, I want to try to achieve that by using Fastlane, since Fastlane is already installed on Codemagic machines (but any other option is welcomed).

I'm new to Fastlane and I try to init Fastlane for the Android (and same for iOS) part of my Flutter app.

So as per the documentation, I ran fastlane init on my android directory.

But at some point, I need to enter the package name. But since my app has 2 flavors, and therefore 2 package names, I don't know how I should setup Fastlane in this kind of situation.

So how can I properly setup Fastlane for my two flavors (Android and / or iOS)?

Thanks for your help.

Upvotes: 1

Views: 411

Answers (1)

Hadiuzzaman
Hadiuzzaman

Reputation: 454

To configure multiple flavors for an Android APK, you can set up your Fastfile configuration like this:

gradle(
  task: 'assemble',
  flavor: 'development',
  flags: "-Ptarget=lib/main_development.dart",
  build_type: 'Release',
  properties: {
    "android.injected.signing.store.file" => ENV['PWD'] + "/app/upload-keystore.jks",
    "android.injected.signing.store.password" => "yourKeyStorePassword",
    "android.injected.signing.key.alias" => "upload",
    "android.injected.signing.key.password" => "yourKeyStorePassword",
  }
)

For iOS: Just pass scheme name it will auto detect the file location.

build_app(
  workspace: "Runner.xcworkspace",
  configuration: "Debug",
  silent: true,
  clean: true,
  output_name: "Appname.ipa",
  scheme: "Release"
)

Upvotes: 1

Related Questions