<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ali Maher</title>
    <description>The latest articles on DEV Community by Ali Maher (@alimaherofficial).</description>
    <link>https://dev.to/alimaherofficial</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1230276%2F53dfc602-11c9-407c-886f-a81c6027b936.jpeg</url>
      <title>DEV Community: Ali Maher</title>
      <link>https://dev.to/alimaherofficial</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alimaherofficial"/>
    <language>en</language>
    <item>
      <title>Simplifying Flutter Deployment with FastLane</title>
      <dc:creator>Ali Maher</dc:creator>
      <pubDate>Sun, 04 Feb 2024 09:44:27 +0000</pubDate>
      <link>https://dev.to/alimaherofficial/simplifying-flutter-deployment-with-fastlane-1f80</link>
      <guid>https://dev.to/alimaherofficial/simplifying-flutter-deployment-with-fastlane-1f80</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;In the world of mobile app development, efficiency and automation are key. FastLane offers a suite of tools designed to automate the deployment of mobile apps, making it an indispensable tool for Flutter developers. This guide will walk you through setting up FastLane for Android and macOS, ensuring a smoother deployment process for your Flutter apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started with FastLane&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Install FastLane
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Android&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;install Ruby&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you can use &lt;strong&gt;&lt;a href="https://rubyinstaller.org/" rel="noopener noreferrer"&gt;RubyInstaller&lt;/a&gt; or  the following terminal commands&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;make sure to open the terminal as an administrator  (Windows users only)&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;choco&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ruby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# you must have Chocolatey package manager &lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;gem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;bundler&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;ruby&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Install Fastlane&lt;/p&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;fastlane&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;set environment variables&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open: environment variables form search bar&lt;/li&gt;
&lt;li&gt;under system variables add those keys and values&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylzjg0rp0w8771a6gk7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylzjg0rp0w8771a6gk7i.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    LC_ALL ⇒ en_US.UTF-8
    LANG ⇒ en_US.UTF-8
    FLUTTER_ROOT=&amp;lt;Your flutter root file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;macOS&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;install ruby&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open terminal the write&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;ruby &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;bundler &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ruby &lt;span class="nt"&gt;--version&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Install Fastlane&lt;/p&gt;

&lt;p&gt;Homebrew needs to be installed before executing &lt;strong&gt;&lt;code&gt;brew&lt;/code&gt;&lt;/strong&gt; commands, as new macOS users might not have it installed. &lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;fastlane
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;set environment variables&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open: finder then go to the top bar click Go ⇒ home&lt;/li&gt;
&lt;li&gt;after opening home click cmd&amp;amp;shift&amp;amp;. to see the hidden files then open .zprofile file&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;add those lines to your .zprofile file&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/opt/homebrew/opt/ruby/bin:&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;&lt;span class="s2"&gt;”
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export FLUTTER_ROOT="&lt;/span&gt;&amp;lt;Your flutter root file&amp;gt;&lt;span class="s2"&gt;" # examle /Users/alimaher/fvm/default/
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h1&gt;
  
  
  FastLane For Android
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Setting up *fastlane&lt;/strong&gt;*

&lt;ul&gt;
&lt;li&gt;In the Visual Studio Code terminal, navigate to the Android folder &lt;code&gt;cd android&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;then run &lt;code&gt;fastlane init&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;You'll be asked to confirm that you're ready to begin, and then for a few pieces of information. To get started quickly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Provide the package name for your application when asked (e.g. io.fabric.yourapp)&lt;/li&gt;
&lt;li&gt;Press enter when asked for the path to your json secret file&lt;/li&gt;
&lt;li&gt;Answer 'n' when asked if you plan on uploading info to Google Play via fastlane (we can set this up later)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it! &lt;em&gt;fastlane&lt;/em&gt; will automatically generate a configuration for you based on the information provided.&lt;/p&gt;

&lt;p&gt;You can see the newly created &lt;code&gt;./fastlane&lt;/code&gt; directory, with the following files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Appfile&lt;/code&gt; which defines configuration information that is global to your app&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Fastfile&lt;/code&gt; which defines the "lanes" that drive the behavior of &lt;em&gt;fastlane&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setting up *supply&lt;/strong&gt;*&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;supply&lt;/em&gt; is a &lt;em&gt;fastlane&lt;/em&gt; tool that uploads app metadata, screenshots and binaries to Google Play. You can also select tracks for builds and promote builds to production!&lt;/p&gt;

&lt;p&gt;For &lt;em&gt;supply&lt;/em&gt; to be able to initialize, you need to have successfully uploaded an APK to your app in the Google Play Console at least once.&lt;/p&gt;

&lt;p&gt;Setting it up requires downloading a credentials file from your Google Developers Service Account.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Collect your Google credentials&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; If you see Google Play Console or Google Developer Console in your local language, add &lt;code&gt;&amp;amp;hl=en&lt;/code&gt; at the end of the URL (before any &lt;code&gt;#...&lt;/code&gt;) to switch to English. All the links below already have this to make it easier to find the correct buttons.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you face issues when following these instructions, you might want to refer to the &lt;a href="https://developers.google.com/android-publisher/getting_started/?hl=en" rel="noopener noreferrer"&gt;official documentation by Google&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://play.google.com/console/?hl=en" rel="noopener noreferrer"&gt;Google Play Console&lt;/a&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Account Details&lt;/strong&gt;, and note the &lt;strong&gt;Developer Account ID&lt;/strong&gt; listed there&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Enable the &lt;a href="https://console.developers.google.com/apis/api/androidpublisher.googleapis.com/?hl=en" rel="noopener noreferrer"&gt;Google Play Developer API&lt;/a&gt; by selecting an existing Google Cloud Project that fits your needs and pushing &lt;strong&gt;ENABLE&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;If you don't have an existing project or prefer to have a dedicated one for &lt;em&gt;fastlane&lt;/em&gt;, &lt;a href="https://console.cloud.google.com/projectcreate/?hl=en" rel="noopener noreferrer"&gt;create a new one here&lt;/a&gt; and follow the instructions&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;Open &lt;a href="https://console.cloud.google.com/iam-admin/serviceaccounts?hl=en" rel="noopener noreferrer"&gt;Service Accounts on Google Cloud&lt;/a&gt; and select the project you'd like to use

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;CREATE SERVICE ACCOUNT&lt;/strong&gt; button at the top of the &lt;strong&gt;Google Cloud Platform Console&lt;/strong&gt; page&lt;/li&gt;
&lt;li&gt;Verify that you are on the correct Google Cloud Platform Project by looking for the &lt;strong&gt;Developer Account ID&lt;/strong&gt; from earlier within the light gray text in the second input, preceding &lt;code&gt;.iam.gserviceaccount.com&lt;/code&gt;, or by checking the project name in the navigaton bar. If not, open the picker in the top navigation bar, and find the right one.&lt;/li&gt;
&lt;li&gt;Provide a &lt;code&gt;Service account name&lt;/code&gt; (e.g. fastlane-supply)&lt;/li&gt;
&lt;li&gt;Copy the generated email address that is noted below the &lt;code&gt;Service account-ID&lt;/code&gt; field for later use&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;DONE&lt;/strong&gt; (don't click &lt;strong&gt;CREATE AND CONTINUE&lt;/strong&gt; as the optional steps such as granting access are not needed):&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk906w8qug3dhpqeyzrdb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk906w8qug3dhpqeyzrdb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6. Click on the **Actions** vertical three-dot icon of the service account you just created
7. Select **Manage keys** on the menu
8. Click **ADD KEY** → **Create New Key**
9. Make sure **JSON** is selected as the `Key type`, and click **CREATE**
10. Save the file on your computer when prompted and remember where it was saved at
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;a href="https://play.google.com/console/?hl=en" rel="noopener noreferrer"&gt;Google Play Console&lt;/a&gt; and select &lt;strong&gt;Users and Permissions&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Invite new users&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Paste the email address you saved for later use into the email address field&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Account Permissions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose the permissions you'd like this account to have. We recommend &lt;strong&gt;Admin (all permissions)&lt;/strong&gt;, but you may want to manually select all checkboxes and leave out some of the &lt;strong&gt;Releases&lt;/strong&gt; permissions such as &lt;strong&gt;Release to production, exclude devices, and use Play App Signing&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Invite User&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;You can use&lt;br&gt;
 &lt;code&gt;[fastlane run validate_play_store_json_key json_key:/path/to/your/downloaded/file.json](https://docs.fastlane.tools/actions/validate_play_store_json_key/)&lt;/code&gt; to test the connection to Google Play Store with the downloaded private key. Once that works, add the path to the JSON file to your &lt;a href="https://docs.fastlane.tools/advanced/Appfile" rel="noopener noreferrer"&gt;Appfile&lt;/a&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;json_key_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"path/to/your/play-store-credentials.json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;package_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"my.package.name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Fetch your app metadata&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If your app has been created on the Google Play developer console, you're ready to start using &lt;em&gt;supply&lt;/em&gt; to manage it! Run:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fastlane supply init

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and all of your current Google Play store metadata will be downloaded to &lt;code&gt;fastlane/metadata/android&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test and deploy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;internal test&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open: &lt;code&gt;android/fastlane/Fastfile&lt;/code&gt; file, in this file you will add your setting for upload new aab for internal testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;default_platform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:android&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# upload to internal test to Google Play&lt;/span&gt;
&lt;span class="n"&gt;lane&lt;/span&gt; &lt;span class="ss"&gt;:internal&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; 
  &lt;span class="c1"&gt;# build the app bundle if you haven't already &lt;/span&gt;
  &lt;span class="n"&gt;gradle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;task: &lt;/span&gt;&lt;span class="s1"&gt;'bundleRelease'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# Upload to internal test&lt;/span&gt;
  &lt;span class="n"&gt;upload_to_play_store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="ss"&gt;track: &lt;/span&gt;&lt;span class="s1"&gt;'internal'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;aab: &lt;/span&gt;&lt;span class="s1"&gt;'../build/app/outputs/bundle/release/app-release.aab'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Update this path if your AAB is generated in a different location&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_apk: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_images: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_screenshots: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_metadata: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_changelogs: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_aab: &lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;now increase your build number in pubspec.yaml&lt;/li&gt;
&lt;li&gt;now in your terminal run the following commands:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;flutter clean
flutter pub get
flutter build appbundle
&lt;span class="nb"&gt;cd&lt;/span&gt; ./android/
fastlane internal &lt;span class="c"&gt;# Now you will push your aab to the internal test&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;release&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open: &lt;code&gt;android/fastlane/Fastfile&lt;/code&gt; file, in this file you will add your sitting for upload new aab for internal testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;default_platform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:android&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# upload release to Google Play&lt;/span&gt;
&lt;span class="n"&gt;lane&lt;/span&gt; &lt;span class="ss"&gt;:release&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;gradle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;task: &lt;/span&gt;&lt;span class="s1"&gt;'bundleRelease'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# Upload to internal test&lt;/span&gt;
  &lt;span class="n"&gt;upload_to_play_store&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="ss"&gt;track: &lt;/span&gt;&lt;span class="s1"&gt;'production'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;aab: &lt;/span&gt;&lt;span class="s1"&gt;'../build/app/outputs/bundle/release/app-release.aab'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Update this path if your AAB is generated in a different location&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_apk: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_images: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_screenshots: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_metadata: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_changelogs: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;skip_upload_aab: &lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;now increase your build number in pubspec.yaml&lt;/li&gt;
&lt;li&gt;now in your terminal run the following commands:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;flutter clean
flutter pub get
flutter build appbundle
&lt;span class="nb"&gt;cd&lt;/span&gt; ./android/
fastlane release &lt;span class="c"&gt;# Now you will push your aab to the internal test&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;&lt;p&gt;increase version number automatically&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;add script.rb file:&lt;/p&gt;

&lt;p&gt;create new file &lt;code&gt;script.rb&lt;/code&gt; in android folder: &lt;code&gt;andoird/script.rb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;this code will edit in your pubspec.yaml file to increase your version&lt;/p&gt;

&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# pubspec_path = '../pubspec.yaml'&lt;/span&gt;
&lt;span class="n"&gt;pubspec_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expand_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'../../pubspec.yaml'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kp"&gt;__FILE__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Read the file into an array of lines&lt;/span&gt;
&lt;span class="n"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readlines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pubspec_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Find the line containing the version and update it&lt;/span&gt;
&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map!&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start_with?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'version:'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="sr"&gt;/(\d+)\.(\d+)\.(\d+)\+(\d+)/&lt;/span&gt;
      &lt;span class="n"&gt;major&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;minor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="vg"&gt;$1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="vg"&gt;$2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="vg"&gt;$3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="vg"&gt;$4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_i&lt;/span&gt;
      &lt;span class="n"&gt;patch&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
      &lt;span class="n"&gt;build&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
      &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"version: &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;major&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;minor&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;patch&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;+&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="c1"&gt;# Write the updated lines back to the file&lt;/span&gt;
&lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pubspec_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'w'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;puts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;open: &lt;code&gt;android/fastlane/Fastfile&lt;/code&gt; file, in this file you will add your sitting for increase your version number automatically&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;lane&lt;/span&gt; &lt;span class="ss"&gt;:icrease_build_number&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="c1"&gt;# script.rb is a ruby script that increments the build number in pubspec.yaml&lt;/span&gt;
  &lt;span class="nb"&gt;system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ruby ../script.rb"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;now increase your build number in pubspec.yaml&lt;/li&gt;
&lt;li&gt;now in your terminal run the following commands:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./android/
fastlane icrease_build_number 
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;you can use both of release or internal and icrease_build_number fastlane action to fully automate your deployment steps using this code:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ./android/
fastlane icrease_build_number
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
flutter clean
flutter pub get
flutter build appbundle
&lt;span class="nb"&gt;cd&lt;/span&gt; ./android/
fastlane release &lt;span class="c"&gt;# or use internal &lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>flutter</category>
      <category>fastlane</category>
      <category>android</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
