Last active
November 11, 2025 12:56
-
-
Save jtmuller5/49ca2e5ddb5128ba6c1301b2415df56f to your computer and use it in GitHub Desktop.
Android and iOS Fastfiles for Flutter App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # android/fastlane/Fastfile | |
| update_fastlane | |
| default_platform(:android) | |
| platform :android do | |
| lane :bump_version_code do | |
| versionCode = File.read("metadata/versionCode").to_i | |
| versionCode = versionCode + 1 | |
| f = File.new("metadata/versionCode", "w") | |
| f.write(versionCode) | |
| f.close | |
| versionCode | |
| end | |
| desc "Deploy a new version to the Google Play" | |
| lane :prod do | |
| versionCode = bump_version_code | |
| sh("flutter", "build", "appbundle", "--build-number=#{versionCode}", "--dart-define-from-file=assets/config.json") | |
| upload_to_play_store( | |
| track: 'production', | |
| aab: '../build/app/outputs/bundle/release/app-release.aab', | |
| ) | |
| send_slack_notification(message: "New production version #{versionCode} has been pushed to Google Play!") | |
| end | |
| desc "Deploy a new version to the beta test track of Google Play" | |
| lane :internal do | |
| versionCode = bump_version_code | |
| sh("flutter", "build", "appbundle", "--build-number=#{versionCode}", "--dart-define-from-file=assets/config.json") | |
| upload_to_play_store( | |
| track: 'internal', | |
| aab: '../build/app/outputs/bundle/release/app-release.aab', | |
| ) | |
| send_slack_notification(message: "New internal version #{versionCode} has been pushed to Google Play!") | |
| end | |
| desc "Send a message to Slack" | |
| lane :send_slack_notification do |options| | |
| message = options[:message] || "A new update has been pushed!" | |
| slack( | |
| message: message, | |
| success: true, | |
| slack_url: ENV["SLACK_WEBHOOK_URL"] | |
| ) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ios/fastlane/Fastfile | |
| update_fastlane | |
| default_platform(:ios) | |
| platform :ios do | |
| lane :bump_version_code do | |
| versionCode = File.read("metadata/versionCode").to_i | |
| versionCode = versionCode + 1 | |
| f = File.new("metadata/versionCode", "w") | |
| f.write(versionCode) | |
| f.close | |
| versionCode | |
| end | |
| lane :bump_version_name do | |
| version_name = File.read("metadata/versionName").to_i | |
| version_name = version_name + 1 | |
| f = File.new("metadata/versionName", "w") | |
| f.write(version_name) | |
| f.close | |
| version_name | |
| end | |
| desc "Push a new release build to the App Store" | |
| lane :prod do | |
| versionCode = bump_version_code | |
| version_name = bump_version_name | |
| sh("flutter","build","ipa","--build-name", "#{version_name}","--dart-define-from-file=assets/config.json") | |
| upload_to_app_store(ipa: "../build/ios/ipa/myApp.ipa", | |
| submit_for_review: true, | |
| automatic_release: true, | |
| force: true, | |
| submission_information: { | |
| "export_compliance_uses_encryption": false, | |
| "add_id_info_uses_idfa": false} | |
| ) | |
| send_slack_notification(message: "New production version #{versionCode} has been pushed to App Store!") | |
| end | |
| desc "Push a new beta build to TestFlight" | |
| lane :beta do | |
| versionCode = bump_version_code | |
| version_name = bump_version_name | |
| sh("flutter","build","ipa","--build-name", "#{version_name}","--dart-define-from-file=assets/config.json") | |
| upload_to_testflight(ipa: "../build/ios/ipa/myApp.ipa") | |
| send_slack_notification(message: "New internal version #{versionCode} has been pushed to TestFlight!") | |
| end | |
| desc "Send a message to Slack" | |
| lane :send_slack_notification do |options| | |
| message = options[:message] || "A new update has been pushed!" | |
| slack( | |
| message: message, | |
| success: true, | |
| slack_url: ENV["SLACK_WEBHOOK_URL"] | |
| ) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm encountering an issue when running Fastlane with the following directory structure:
The
Fastfileis configured to loadandroid.rbandiOS.rbusing the following code:Fastfile:
I am running the following commands:
fastlane android prodfastlane android internalfastlane ios prodfastlane ios internalHowever, when I try to run these commands, I get the following error:
It seems that Fastlane is incorrectly looking for the
android.rbfile at the path/flutter_advanced_topics/fastlane/fastlane/android.rbinstead of/flutter_advanced_topics/fastlane/android.rb, which is where the file actually resides.What I’ve tried:
android.rbandiOS.rbare correctly placed inside thefastlane/folder.Fastfileand confirmed thatandroid.rbandiOS.rbare being loaded using the correct paths.Expected Behavior:
Fastlane should correctly load the
android.rbandiOS.rbfiles from thefastlane/directory.Environment:
Can anyone help me resolve this issue? Thank you in advance!