2

Hi I'm new to fastlane and I have a react native iOS & android application which I have setup with fastlane. I have multiple productFlavors for its different app versions:

productFlavors {
    flavor1 {
        applicationId "com.package.flavor1"
    }
    flavor2 {
        applicationId "com.package.flavor2"
    }
    flavor3 {
        applicationId "com.package.flavor3"
    }
    flavor4 {
        applicationId "com.package.flavor4"
    }

Now on my Fastfile, I can generate all the AAB for all flavors using the generic gradle command.

gradle( task: 'clean bundle', build_type: 'release', project_dir:'android/')

When I try to run the upload command, fastlane asks for package_name paramter

upload_to_play_store(release_status: releaseStatus, changes_not_sent_for_review: shouldSendReview)

I want to be able to iterate to all flavors and maybe access its applicationId key to append the command with it but Im not sure where to go. Everything I looked into only assumes that project has single package name. Can someone guide me on the ropes for this on fastlane. Thank you.

MetaSnarf
  • 5,857
  • 3
  • 25
  • 41

1 Answers1

0

You can invoke fastlane with the package name. Unfortunately, there are two different ways to do it for different parts of the process.

For fastlane supply, you can provide it as a command-line option: fastlane supply init --package name com.package.flavor1.

For specific lanes, you have to provide it as an option flag to the lane:

lane :flavor1 do |options|
  upload_to_play_store(
    package_name: options[:package_name],
    <etc>
  )
end

And then you can invoke the lane with the option: fastlane flavor1 package_name:com.package.flavor1

karl
  • 3,544
  • 3
  • 30
  • 46