<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mai Samir on Medium]]></title>
        <description><![CDATA[Stories by Mai Samir on Medium]]></description>
        <link>https://medium.com/@mai.samir.mohammad?source=rss-1a701774888d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rF-V5Y5hYUuvTbQ7f82tmQ.jpeg</url>
            <title>Stories by Mai Samir on Medium</title>
            <link>https://medium.com/@mai.samir.mohammad?source=rss-1a701774888d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:25:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mai.samir.mohammad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Complete CI/CD Pipeline for Android: From Local Development to Automated Distribution]]></title>
            <link>https://medium.com/@mai.samir.mohammad/building-a-complete-ci-cd-pipeline-for-android-from-local-development-to-automated-distribution-176dfd26d117?source=rss-1a701774888d------2</link>
            <guid isPermaLink="false">https://medium.com/p/176dfd26d117</guid>
            <category><![CDATA[circleci]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[fastlane]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Mai Samir]]></dc:creator>
            <pubDate>Thu, 06 Nov 2025 01:49:10 GMT</pubDate>
            <atom:updated>2025-11-06T01:49:10.950Z</atom:updated>
            <content:encoded><![CDATA[<p>A comprehensive guide to automating Android builds, signing, and distribution using Fastlane, Firebase App Distribution, and CircleCI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3sSkwaxcd6eH6ihsDA0wbw.png" /><figcaption>The Image is created by Gemini</figcaption></figure><h3>Introduction</h3><p>CI/CD is more than just a buzzword in mobile development — it’s an essential automation framework that saves time and costs while ensuring consistent, high-quality app releases. If you’re aiming for senior positions in Android development, mastering CI/CD is practically mandatory.</p><p>In this comprehensive guide, I’ll walk you through implementing CI/CD for Android apps using Fastlane, Firebase App Distribution, and CircleCI. By the end, you’ll have a fully automated pipeline that builds and distributes your app with a single command.</p><h3>What is CI/CD?</h3><p><strong>CI/CD</strong> stands for <strong>Continuous Integration</strong> and <strong>Continuous Delivery</strong>. It automates the process of integrating features into your software until it’s ready for delivery to users.</p><h3>The Integration Process</h3><p>The integration process typically kicks in after you merge your feature branch into the main branch. Common steps include:</p><ol><li><strong>Running tests</strong> (unit tests, integration tests) to ensure no breaking changes</li><li><strong>Extracting a build</strong> for the app (APK or AAB)</li><li><strong>Sending the build</strong> to the QA team, testers, or product owners for validation</li></ol><h3>The Delivery Process</h3><p>The delivery process starts with creating a build package (.apk or .aab) and ends with delivering your app to users through Google Play Store.</p><h3>Benefits of CI/CD</h3><ul><li><strong>Faster release rate</strong> — Ship features more frequently</li><li><strong>Reduced time to delivery</strong> — From development to production in less time</li><li><strong>Lower development costs</strong> — Automation reduces manual effort</li><li><strong>Better code quality</strong> — Automated testing catches issues early</li><li><strong>Improved developer experience</strong> — Less time on repetitive tasks, more time coding</li></ul><h3>Setting Up Your Project</h3><p>Before diving into CI/CD, let’s set up a basic Android app to work with. Create a new Android project in Android Studio and ensure it runs successfully.</p><h3>Installing Fastlane</h3><p><strong>Fastlane</strong> is an open-source tool from Google that automates everything in mobile development. Whether you need to automate screenshots, beta deployment, app store deployment, or code signing — Fastlane has you covered.</p><h3>Key Capabilities</h3><ol><li>Automate screenshots</li><li>Beta deployment</li><li>App store deployment</li><li>Code signing</li></ol><h3>Installation Steps</h3><h4>1. Install a Ruby Environment Manager</h4><p>In the documentation, you will find that the recommended way to install Fastlane is to use a <strong>managed Ruby environment + Bundler</strong></p><p>Why manage a Ruby environment?</p><p>Because on macOS, there is already a Ruby system, but it is not the recommended way to work; you should download a managed Ruby environment</p><p><em>If you are using </em><strong><em>Windows,</em></strong><em> I recommend installing Ruby directly from the Ruby installer for Windows and choosing an older version. I used Ruby 3.0.7 with DevKit because the newer versions don’t include some gems(dependencies) that you may need. If you did that, you can jump to the I</em><strong><em>nstall Bundler</em></strong><em> step.</em></p><p><strong><em>Here is the other option</em>:<br><em>rbenv</em></strong> is one of the most popular ways to manage your Ruby environment.</p><p><em>Fastlane</em> supports Ruby versions 2.5 or newer.</p><p>You have to make sure that you can execute Ruby programs on your device because Fastlane is built with Ruby; you must have Ruby installed + bundler (package manager for Ruby)</p><p>Go to this link to get a manager depending on your OS</p><p><a href="https://www.ruby-lang.org/en/documentation/installation/#managers">https://www.ruby-lang.org/en/documentation/installation/#managers</a></p><p><strong>For macOS/Linux:</strong></p><p><a href="https://github.com/rbenv/rbenv#readme">rbenv</a> allows you to manage multiple installations of Ruby. While it can’t install Ruby by default, its <a href="https://www.ruby-lang.org/en/documentation/installation/#ruby-build">ruby-build</a> plugin can. Both tools are available for macOS, Linux, or other UNIX-like operating systems.</p><p><strong>For Windows:</strong></p><p><a href="https://github.com/RubyMetric/rbenv-for-windows#readme">rbenv for Windows</a> allows you to install and manage multiple installations of Ruby on Windows. It’s written in PowerShell thus providing a native way to use Ruby for Windows users. Besides, the command line interface is compatible with <a href="https://github.com/rbenv/rbenv#readme">rbenv</a> on UNIX-like systems.</p><p><strong>Verify rbenv installation (Windows PowerShell):</strong></p><pre>rbenv -v<br>rbenv versions</pre><p>If you encounter issues, add these to your system path:</p><ul><li>C:\Ruby-on-Windows\rbenv\bin</li><li>C:\Ruby-on-Windows\shims</li><li>Add RBENV_ROOT as an environment variable with value: C:\Ruby-on-Windows</li></ul><p>The second problem you may face is that your device may see your system versions, not the rbenv version in macOS, so you can specify the version by running this command: rbenv local 2.7.5</p><p>If the problem is still there, check this question on Stack Overflow <a href="https://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version">https://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version</a></p><h4>2. Install Bundler</h4><p>Bundler is a package manager for Ruby that manages your dependencies.<br>gemIt&#39;s the way that lets you install any Ruby packages.</p><pre>gem install bundler</pre><p><strong>For Git Bash users</strong>, edit your ~/.bashrc file:</p><pre>nano ~/.bashrc</pre><p>Add this line:</p><pre>export PATH=&quot;/c/Ruby-on-Windows/3.4.4-1/bin:$PATH&quot;</pre><p>Press Ctrl + X, then y, then Enter to save.</p><h4>3. Create a Gemfile</h4><p>In your project root directory, create a file named Gemfilewith the content:</p><pre>source &quot;https://rubygems.org&quot;<br>gem &quot;fastlane&quot;</pre><p>This file is similar to package.json in Node.js—it defines your Ruby dependencies, so from the above lines, I said in it that I need the Fastlane dependency.</p><h4>4. Install Dependencies</h4><pre>bundle update</pre><p>This creates Gemfile.lock, confirming successful installation. Add both files to version control.</p><p><strong>Important:</strong></p><p>Always run Fastlane commands with :</p><pre>bundle exec fastlane [lane]</pre><p>As your first build step on your CI, add:</p><pre>bundle install</pre><p>To update Fastlane, just run:</p><pre>bundle update fastlane </pre><h3>Configuring Fastlane</h3><p>You may need to add the Fastlane path to the system variable path at first. Navigate to your Android app directory and run:</p><pre>fastlane init</pre><p>You’ll be prompted with several questions:</p><ol><li><strong>Package name</strong>: Enter your app’s package name (e.g., com.example.cicdproject)</li><li><strong>JSON secret file path</strong>: Press Enter to skip</li><li><strong>Download existing metadata and setup metadata management?(y/n):</strong> Press n</li><li>Press Enter three more times to continue</li></ol><p>This creates a fastlane folder in your project with two important files:</p><ul><li><strong>Appfile</strong>: Contains your app configuration</li><li><strong>Fastfile</strong>: Contains your lanes (building blocks of Fastlane, similar to functions)</li></ul><h3>Understanding Lanes</h3><p>A lane is a series of actions grouped together. Here’s the basic structure:</p><pre>desc &quot;Description of what this lane does&quot;<br>lane :lane_name do<br>  # Actions go here<br>end</pre><h3>Testing Your Fastlane Setup</h3><p>Open fastlane/Fastfile and replace the content with:</p><pre>default_platform(:android)<br>platform :android do<br>  desc &quot;Runs all the tests&quot;<br>  lane :test do<br>    print &quot;Fastlane running successfully&quot;<br>  end<br>end</pre><p>Execute this command (the lane):</p><pre>bundle exec fastlane test</pre><p>You should see “Fastlane running successfully” printed in your terminal.</p><h3>Building Your App with Fastlane</h3><p>Before using Fastlane, let’s understand how to create builds manually using Gradle (Android’s build tool).</p><h3>Creating a Debug Build Manually</h3><pre>./gradlew assembleDebug</pre><p>This creates a debug build at: app/build/outputs/apk/debug/app-debug.apk</p><p><strong>Note: <br></strong>If you encountered an error like this: <br><em>Android Gradle plugin requires Java 17 to run. You are currently using Java 11.</em><br>So you have to download Java version 17 and set it in your environment variables, and make sure to be in the first line of the path if you have more than one version of it in the path variable</p><h3>Creating a Debug Build with Fastlane</h3><p>Add this lane to your Fastfile:</p><pre>desc &quot;Prepare Android Debug Build&quot;<br>lane :build_debug_android do<br>  gradle(<br>    task: &quot;assembleDebug&quot;<br>  )<br>end</pre><p>Execute:</p><pre>bundle exec fastlane build_debug_android</pre><p>Fastlane will create the debug build for you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*o-DnYBQ2oy8lDPVYJQRTTg.png" /><figcaption>The debug folder</figcaption></figure><h3>Signing Your Android App</h3><p>Before creating a release build, you must sign your app. Android requires all APK files to be signed before installation or distribution.</p><h3>Understanding App Signing</h3><p><strong>Signing</strong> means attaching a digital certificate to your app, proving it comes from a trusted source.</p><p><strong>For Debug:</strong></p><p>Automatically signed by Android Studio using a debug key</p><p><strong>For Release:</strong></p><p>You must manually sign using your keystore</p><h3>What is a Keystore?</h3><p>A keystore is a file (.jks or .keystore) containing:</p><ol><li>A <strong>private key</strong> used to sign the APK</li><li>A <strong>digital certificate</strong> with a public key and metadata</li></ol><h3>Generating a Keystore</h3><p>Run this command:</p><pre>keytool -genkey -v -keystore cicd-project-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias cicd-project-alias</pre><p>You’ll be prompted for:</p><ul><li>Keystore password</li><li>Key password</li><li>Distinguished Name fields (name, organization, location, etc.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3a-QEYWEVnaPyufw7PGD9A.png" /><figcaption>Generating a Keystore</figcaption></figure><p>This generates cicd-project-release-key.jks valid for 10,000 days. Move this file to your app folder.</p><h3>Configuring Gradle to Sign Your App</h3><p>For security, create a keystore.properties file in your project root:</p><pre>storeFile=D\:/AndroidStudioProjects/CICDProject/app/cicd-project-release-key.jks<br>storePassword=password<br>keyAlias=cicd-project-alias<br>keyPassword=password</pre><p><strong>Important:</strong> Add keystore.properties to .gitignore to keep credentials secure.</p><p>In your app/build.gradle.kts, add:</p><pre>// Load keystore properties<br>val keystorePropertiesFile = rootProject.file(&quot;keystore.properties&quot;)<br>val keystoreProperties = Properties()<br>keystoreProperties.load(FileInputStream(keystorePropertiesFile))</pre><pre>android {<br>    ...<br>    defaultConfig { ... }<br>    <br>    signingConfigs {<br>        create(&quot;release&quot;) {<br>            storeFile = file(keystoreProperties[&quot;storeFile&quot;] as String)<br>            storePassword = keystoreProperties[&quot;storePassword&quot;] as String<br>            keyAlias = keystoreProperties[&quot;keyAlias&quot;] as String<br>            keyPassword = keystoreProperties[&quot;keyPassword&quot;] as String<br>        }<br>    }<br>    <br>    buildTypes {<br>        getByName(&quot;release&quot;) {<br>            signingConfig = signingConfigs.getByName(&quot;release&quot;)<br>            ...<br>        }<br>    }<br>}</pre><p>Test your configuration, write this in the terminal:</p><pre>./gradlew assembleRelease</pre><p>Now you can find the release build</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*y0IjPzfhpy-VF8-POAAPrw.png" /><figcaption>The release build</figcaption></figure><h3>Creating a Release Build with Fastlane</h3><p>Add this lane to your Fastfile:</p><pre>desc &quot;Prepare Android Release Build&quot;<br>lane :build_release_android do<br>  gradle(<br>    task: &quot;assembleRelease&quot;<br>  )<br>end</pre><p>Execute:</p><pre>bundle exec fastlane build_release_android</pre><p>Congratulations! You’ve created a signed release build with Fastlane!</p><h3>Distributing to the QA Team</h3><p>Now we need a distribution channel to get builds to your testers. While Google Play offers testing tracks (Internal, Beta, Alpha) and Apple has TestFlight, we’ll use <strong>Firebase App Distribution</strong> for its cross-platform support and centralized management.</p><h3>Why Firebase App Distribution?</h3><ul><li><strong>Cross-platform</strong>: Distribute both Android and iOS apps from one place</li><li><strong>Easy integration</strong>: Simple setup process</li><li><strong>Centralized management</strong>: Manage testers and groups in one interface</li><li><strong>Automatic notifications</strong>: Testers receive emails when new builds are available</li></ul><h3>Setting Up Firebase App Distribution</h3><ol><li>Create a Firebase project in the Firebase Console</li><li>Add your Android app to the project</li><li>Navigate to <strong>Run</strong> → <strong>App Distribution</strong> in the left sidebar</li><li>Click <strong>Get started</strong></li></ol><h3>Adding the Firebase Plugin to Fastlane</h3><p>Add the Firebase App Distribution plugin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rbNHV8dky9RA9Bc4y9ziFw.png" /></figure><pre>cd fastlane<br>fastlane add_plugin firebase_app_distribution</pre><p>Then it will ask you</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*RGjohq6DOnBKC_mfqJQdRA.png" /></figure><p>After that, you will find this file added to your <strong>Pluginfile,</strong> and it has this content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Pq1WrWiz11s7Zk09PFiEVw.png" /></figure><p>As the app depends on this plugin so it is added as a gem</p><p>And these lines will be added automatically in the <strong>Gemfile,</strong> as it is the first time to integrate the plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*iIA0a94eCCEogjC8oZ3bsA.png" /></figure><p>But actually, you will need to add the folder name before the <strong>Pluginfile</strong> because it expects the <strong>Pluginfile</strong> in the same directory of<strong> the Gemfile</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vUv1eVqlsfV14_I2ctpyIg.png" /></figure><p>Then run:</p><pre>bundle install<br>bundle exec fastlane install_plugins</pre><p><strong>Now we are ready to use this plugin!</strong></p><h3>Authenticating with Firebase</h3><p>We’ll use the Firebase CLI for authentication:</p><ol><li>Install Firebase CLI following the instructions at <a href="https://firebase.google.com/docs/cli">https://firebase.google.com/docs/cli</a></li></ol><p>Based on your OS, you can find more than one way to install</p><p>I followed these steps</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*pIMQhgPPCkMBXxCqC1aSig.png" /></figure><p>Then, after you install and setup Firebase CLI, it will ask you</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*-A0exW1vjhTPhlj8DA_u9A.png" /></figure><p>Then</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*U9F1kSsCr_dphpnHAcgYtA.png" /></figure><p>Then it will let you log in like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*IXiupS8xmerNzEhzJOdx6Q.png" /></figure><p>Now you are logged in, but it didn’t give you a token to solve this; you have to log in with CI</p><p>2. Login to Firebase with CI:</p><pre>firebase login:ci</pre><p>This generates a token for authenticating with Firebase App Distribution.</p><p><strong>Important:</strong> Store this token securely. Add it to a firebase.properties file and include that file in .gitignore.</p><h3>Adding Testers</h3><p>In the Firebase Console:</p><ol><li>Go to <strong>App Distribution</strong> → <strong>Testers &amp; Groups</strong></li><li>Add tester emails</li><li>Create groups and assign testers to them</li></ol><h3>Creating a Distribution Lane</h3><p>We want to write a lane now that does two things<br>1- Call the lane we created before that called build_release_android<br>2- Distribute the build to Firebase App distribution by calling the firebase_app_distribution plugin action and sending to it the needed parameters. The first parameter you will need is <strong>app</strong>: you can get the app ID from the project settings on the Firebase console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*fucrG1YTJTlpnvpJH2Ox5w.png" /></figure><p>The second parameter we need is <strong>firebase_cli_token</strong></p><p>The third parameter is groups to specify the testers group</p><p>Add this lane to your Fastfile:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*MfNxpd2LGDazGjPToSXR1Q.png" /></figure><p>Execute:</p><pre>bundle exec fastlane beta_android</pre><p>Your build will be prepared, authenticated, and uploaded to Firebase App Distribution!<br>If you open the project on the Firebase console and click on app distribution, you will find a release</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*JpxnVYYrgj7c0xkl53gC5Q.png" /></figure><h3>Creating Deployment Scripts</h3><p>Let’s create convenient scripts for one-command deployment.</p><p>Create a scripts folder in your project root with two files:</p><p><strong>scripts/prepare.sh:</strong></p><pre>./gradlew clean<br>bundle install<br>bundle exec fastlane install_plugins</pre><p><strong>scripts/beta.sh:</strong></p><pre>bundle exec fastlane beta_android</pre><p>Update the version code in app/build.gradle:</p><pre>defaultConfig {<br>    versionCode = 2<br>    versionName = &quot;1.1&quot;<br>    ...<br>}</pre><p>Deploy by running this in your git bash:</p><pre>bash scripts/prepare.sh<br>bash scripts/beta.sh</pre><p>Now, if you open the Firebase console, you will find the new build there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*t_16H4kIXFhrnB3QzZGqig.png" /></figure><h3>Setting Up CircleCI for Remote Pipeline Execution</h3><p>So far, we’ve been running our pipeline on our local machine. Now, let’s introduce a <strong>remote pipeline machine</strong> using CircleCI.</p><h3>Why Use a Remote Pipeline?</h3><ul><li><strong>Free up your dev machine</strong> while the pipeline runs</li><li><strong>Automate pipeline triggers</strong> on VCS events (push, PR, merge)</li><li><strong>Consistent environment</strong> for builds</li></ul><h3>Integrating CircleCI</h3><ol><li>Go to <a href="https://circleci.com/">https://circleci.com</a> and login with your GitHub account</li><li>Select your account</li><li>Click <strong>Setup Project, </strong>then select your repo(you will find that you have to create config.yml, we will create it later) to give CircleCI access to your repo</li></ol><p>CircleCI will create an SSH key to access your repository but in larger projects, you may want to limit that access, so you may refer to the documentation of CircleCI, <em>particularly</em> in the VCS integration.</p><h3>Creating the CircleCI Configuration</h3><p>To integrate it, open the Fastlane doc and open the CircleCI guide under CI integration. You have to edit your fastfile to setup CircleCI. You have to introduce thebefore_all It will run before any lane <strong>(in macOS)</strong></p><p>And then create .circleci/config.yml In your project root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*jasZcSgokMG-Ja1KpjfyZQ.png" /></figure><p>In that file, you will write jobs and workflows (a set of jobs that run at a certain time, e.g., creating a workflow that runs when you push the code, create pr, or merge, etc.)</p><p><strong>Let’s try a simple example:</strong></p><p>In that file, create a job called try-job<br>You have to specify the remote machine configuration if you opened the documentation of CircleCI under <strong>Images/ Convenience Images/ cimg/android -&gt; </strong>You will find an example for the configuration</p><p><strong>docker: <br> — image: cimg/android:2025.08</strong></p><p>then in the steps of the job run a simple echo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ADK3HBGOVYODuh80iMeXxQ.png" /></figure><pre>version: 2.1<br>jobs:<br>  try-job:<br>    docker:<br>      - image: cimg/android:2025.08<br>    steps:<br>      - run:echo &quot;I&#39;m a job named try-job within a workflow named try-workflow.&quot;</pre><pre>workflows:<br>  try-workflow:<br>    jobs:<br>      - try-job</pre><p>Then push this to GitHub<br>If you clicked on setup project now, it will work because you created the confing.yml, and you must push it to github also, so CircleCI can find it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*DH2Lu-G3eemwRvFqkiewOA.png" /></figure><p>Now, let’s check if it runs the workflow or not</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*DB0TMic80rReFgDdE3Oqpw.png" /></figure><p>Successfully runs the workflow!</p><p>If you didn’t put any restrictions on your workflow, it will run with every push.<br>The job that we created is very simple, but the thing that took time is preparing the environment, as it prepares a machine for you.<br>If you open your repo settings and click the deploy keys, you will find a new key called circleci.<br>CircleCI created it after you gave it access to your repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WeGzyV-YGY0TUi4OJVKQIA.png" /></figure><h3><strong>Now we want to try our main goal, which is to run our build pipeline on the remote machine using CircleCI</strong></h3><p>Try this code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*eL5QKE4vjELhaaMUVO2_QA.png" /></figure><p>Then increment the version number in the app/build.gradle<br>Then add, commit, and push your changes</p><h3>Handling Common Issues</h3><h4>1. Gradlew Not Executable</h4><ul><li><strong>Problem:</strong> CircleCI couldn’t run ./gradlew because it wasn’t marked as executable.</li><li><strong>Solution: write this in your terminal to make gradlew executable:</strong></li></ul><pre>git update-index --chmod=+x gradlew</pre><h4>2. Bundler Permission Issues</h4><ul><li><strong>Problem:</strong> CircleCI tried to install Ruby gems on the remote machine but failed because of permission issues.</li><li><strong>Solution:</strong> made the gems load inside the project itself instead of depending on the remote machine installation.</li></ul><p>Update scripts/prepare.sh:</p><pre>gem install bundler<br>bundle config set --local path &#39;vendor/bundle&#39;<br>bundle install</pre><h4>3. Keystore File Missing</h4><p>Since keystore.properties is excluded from version control, we need to handle it differently:</p><p><strong>Encode your keystore locally:</strong></p><pre>base64 cicd-project-release-key.jks &gt; cicd-project-release-key.jks.base64</pre><p><strong>Add to CircleCI environment variables:</strong></p><ol><li>Go to CircleCI Dashboard → Project Settings → Environment Variables</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*w_uJNqPP4pfw3YGVzSFzyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*BJN0ECu8NIYIWOtCHgiPcw.png" /></figure><p>2. Add these variables:</p><ul><li>Name: KEYSTORE_BASE64</li><li>Value: (paste the full Base64 string from the .base64 file).</li></ul><p><strong>Update </strong><strong>scripts/prepare.sh:</strong></p><p>- Decode the keystore in prepare.sh</p><pre># Decode keystore<br>echo $KEYSTORE_BASE64 | base64 -d &gt; $STORE_FILE</pre><p>This decodes the Base64 string and writes it to a file.<br>Here $STORE_FILE is an environment variable that holds the file name (e.g., cicd-project-release-key.jks).</p><p>- <strong>Add other sensitive values as environment variables in CircleCI</strong></p><ul><li>STORE_PASSWORD</li><li>KEY_ALIAS</li><li>KEY_PASSWORD</li><li>STORE_FILE (e.g., cicd-project-release-key.jks)</li></ul><p>Here is the full code in the prepare.sh file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*dA8kDQE8SvqQT6yJBJ5DMg.png" /></figure><p>Update build.gradle</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*dUEoPUaaDmrgD9Y-nLkTmw.png" /></figure><h4>4. F<strong>irebase.properties missing</strong></h4><ul><li><strong>Problem:</strong> The file was excluded from VCS, so CircleCI couldn’t find the Firebase configuration.</li><li><strong>Solution:</strong> stored the <strong>Firebase CLI token</strong> directly in CircleCI environment variables instead of keeping it in a file, so your beta_android lane in Fasfile now should look like this</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*D5HCO4TASO7Kn1ONLEAjzw.png" /></figure><h3>Final Configuration</h3><p>Your complete .circleci/config.yml:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*VSPQe_9b9teg-Mw9zI8qlg.png" /></figure><p>Once you push the code to your GitHub repo, the pipeline will automatically run, and after it completes successfully, you will see another release on your Firebase app distribution</p><p>Also, an important note you should make sure that all sensitive files are excluded from VCS, and if you included them by mistake, remove them from the git history.</p><h3>Conclusion</h3><p>You’ve now built a complete CI/CD pipeline for Android development! Here’s what you’ve accomplished:</p><ul><li>✅ Automated build generation with Fastlane</li><li>✅ App signing configuration</li><li>✅ Distribution to testers via Firebase App Distribution</li><li>✅ Remote pipeline execution with CircleCI</li><li>✅ One-command deployment scripts</li><li>✅ Secure handling of credentials</li></ul><p>This setup will dramatically improve your development workflow, reduce manual errors, and speed up your release cycle. As you grow more comfortable with CI/CD, you can add more automation, like:</p><ul><li>Automated testing before builds</li><li>Version number auto-incrementing</li><li>Release notes generation</li></ul><h3>Resources</h3><ul><li>1- <a href="https://docs.fastlane.tools/">Fastlane documentation</a></li><li>2- CICD in Mobile Development by Hossam Abdelnasser (<a href="https://www.youtube.com/playlist?list=PL0bESU04Rrw0c1ofAaI_TK3Eph7p-DzEP">YouTube Playlist</a>)</li><li>3- Eslam Basher Summary File (<a href="https://www.linkedin.com/posts/eslam-basher_sign-your-android-app-activity-7324082271475355651-_jpi?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAADU4lQIBuXBWSCZ4zZFwSpc5HsnK8jLJkUY">Sign your Android app</a>)</li><li>4- <a href="https://developer.android.com/build/building-cmdline">Build your app from the command line | Android Studio</a></li><li>5- <a href="https://firebase.google.com/docs/app-distribution">Firebase App Distribution</a></li><li>6- <a href="https://circleci.com/">CircleCI</a></li><li>7- <a href="https://rubyinstaller.org/">Ruby Installer for Windows</a></li></ul><p><strong>About the Author</strong></p><p>Mai Samir — Android Developer</p><p>Connect with me on <a href="https://www.linkedin.com/in/mai-elbanna">LinkedIn</a></p><p><em>Found this guide helpful? Give it a clap and share it with fellow Android developers! Have questions or suggestions? Drop them in the comments below.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=176dfd26d117" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>