---
title: "Implementing a Flutter CI/CD Pipeline in Jenkins: Part 1 (Introduction, Strategy, and Environment Setup) | Bottle Rocket"
description: In order to seriously consider a toolkit for development it must be possible to implement a Continuous Integration/Continuous Deployment pipeline for that toolkit.
image: https://blog.bottlerocketstudios.com/hubfs/Imported_Blog_Media/Flutter_1-3.jpg
---

[![bottlerocket](https://blog.bottlerocketstudios.com/hs-fs/hubfs/_Branding/logos/bottlerocket.png?width=145&height=22&name=bottlerocket.png "bottlerocket")](https://www.bottlerocketstudios.com/)

- [Work](https://www.bottlerocketstudios.com/work)
- [Practices](https://www.bottlerocketstudios.com/practices) 
    - [Design](https://www.bottlerocketstudios.com/practices/design)
    - [Growth](https://www.bottlerocketstudios.com/practices/growth)
    - [Innovation](https://www.bottlerocketstudios.com/practices/innovation)
    - [Product](https://www.bottlerocketstudios.com/practices/product)
    - [Strategy](https://www.bottlerocketstudios.com/practices/strategy)
    - [Technology](https://www.bottlerocketstudios.com/practices/technology)
    - [Healthcare](https://www.bottlerocketstudios.com/practices/healthcare)
    - [Travel & Hospitality](https://www.bottlerocketstudios.com/practices/travel-hospitality)
    - [QSR & Restaurant](https://www.bottlerocketstudios.com/practices/qsr-restaurant)
    - [Cryptocurrency and Web 3.0](https://www.bottlerocketstudios.com/practices/cryptocurrency-web-3-0)
- [About](https://www.bottlerocketstudios.com/about)
- [News & Views](https://blog.bottlerocketstudios.com)
- [Careers](https://www.bottlerocketstudios.com/careers)
- [Contact](https://www.bottlerocketstudios.com/contact)
- [Subscribe](https://share.hsforms.com/1KoyxYf7WTYqHyQiZfGbbQA48zy7?__hstc=259231125.ab0b95bd372707895eaba56d6bff4702.1582818544473.1658346414387.1658413786781.678&__hssc=259231125.2.1658413786781&__hsfp=2588850290)

![Implementing a Flutter CI/CD Pipeline in Jenkins: Part 1 (Introduction, Strategy, and Environment Setup)](https://blog.bottlerocketstudios.com/hubfs/Imported_Blog_Media/Flutter_1-3.jpg)

[Jul 10, 2020 11:26:00 AM](https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup)

# [Implementing a Flutter CI/CD Pipeline in Jenkins: Part 1 (Introduction, Strategy, and Environment Setup)](https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup)

In order to seriously consider a toolkit for development, be it cross-platform or single platform, it must be possible to implement a Continuous Integration/Continuous Deployment pipeline for that toolkit. Flutter is no exception to this, though Flutter’s suggested CI/CD walkthrough didn’t exactly fit [Bottle Rocket](https://www.bottlerocketstudios.com/)’s needs. Flutter has a [page](https://flutter.dev/docs/deployment/cd) on CI/CD that recommends using fastlane as a means to push builds to App stores.

[Bottle Rocket](https://www.bottlerocketstudios.com/)’s needs are a bit more involved than just pushing builds to App stores. At minimum, at [Bottle Rocket](https://www.bottlerocketstudios.com/), we prefer to be able to have new pull requests automatically tested and made into test builds for QA. This generally requires a Jenkins server watching our git repositories. However, Flutter is a bit more complex than just a single platform in terms of integration with Jenkins. At minimum, it requires having the Flutter SDK installed on whatever machine or server is running Jenkins.

This complexity coupled with Flutter’s nascent nature, posed a bit of a challenge as there aren’t many articles or sources for setting up this proposed Jenkins environment. However, it is definitely possible to implement even with minimal(or no) Jenkins/Docker experience! Personally, I’d never set up a Jenkins environment before this foray into the world of CI/CD.

If your build environment is fresh/new and without build tools, you’ll need to install those as well. Additionally, I recommend that your build server will be a MacOS system, as iOS building requires MacOS. The rest of this article assumes all libraries, packages, and SDKs are installed correctly(this can be verified with the ‘flutter doctor command’. Below is a quick list of the things to install. I’ll also go into detail on each item below the list.

- [Homebrew](https://brew.sh/)
- [XCode and Command Line Tools](https://developer.apple.com/xcode/resources/)
- [Flutter SDK](https://flutter.dev/docs/get-started/install/macos)
- [Java](https://adoptopenjdk.net/)
- [Android SDK](https://developer.android.com/studio)
- [Cocoapods](https://cocoapods.org/)
- [Fastlane](https://docs.fastlane.tools/getting-started/ios/setup/)

**Homebrew**

Installing [Homebrew](https://brew.sh/) should be the first thing you do, as it’s used in a lot of other steps below. It’s as simple as pasting the below line into terminal and following the prompts.

`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`

**XCode and Command Line Tools**

If you’re only deploying to Android, you can skip XCode. However, as Flutter’s main strength is that it’s cross-platform, I don’t recommend this. Assuming you’re taking advantage of all Flutter has to offer, you’ll want to install XCode and the appropriate command line tools. This can be done through the [Mac App Store](https://developer.apple.com/xcode/resources/).

**Flutter SDK**

The MacOS Flutter installation [page](https://flutter.dev/docs/get-started/install/macos) details both installing a specific version of the Flutter SDK as well as using git to install the latest stable build. I recommend using the latest stable build personally, and the git cloning method is very simple (Assuming you’ve already installed git. If not, the steps for doing this on MacOS are detailed [here](https://www.atlassian.com/git/tutorials/install-git). I’d recommend using the Homebrew method)! The other bit that the installation page glazes over is setting the ‘flutter’ global PATH. Luckily, another [page](https://flutter.dev/docs/get-started/install/macos#update-your-path) on the official Flutter knowledgebase goes over this! I recommend reading it and following the steps outlined within.

**Java**

In order for your project to generate an Android app, Java must be installed on your machine. OpenJDK is the best option for this. This can be installed with Homebrew with the below command

`brew cask install adoptopenjdk8`

Once Java is installed, JAVA\_HOME must be set in the path. This can be done with an export command, likely similar to the one below. Your path may be different depending on which version you install and where it’s installed. The important bits are at the end, specifically ‘Contents/Home’.

`export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home`

**Android SDK**

In order for Flutter to export Android APK’s, you must install the Android SDK. If you have access to the machine physically and can use a GUI, [Android Studio](https://developer.android.com/studio) a good option. However, I recommend using Homebrew once again, as it’s doable from the terminal.

`brew cask install android-sdk`

Once the SDK is installed, you should set ANDROID\_HOME so Flutter knows where the SDK is. This path may change based on the version of the SDK you install. In my case, the ‘Home’ folder for the SDK was printed out in terminal on completion of the Homebrew installation. After setting the home directory, the next line tells Flutter where it is.

`export ANDROID_HOME=/usr/local/Caskroom/android-sdk/4333796/`

`flutter config --android-sdk $ANDROID_HOME`

In order to install the necessary build tools for Flutter(currently a minimum of API level 28), the below commands must be run. Without the build tools, APKs can’t be built.

`sdkmanager platform-tools "build-tools;29.0.2"`

`sdkmanager platform-tools "platforms;android-29"`

`sdkmanager platform-tools "build-tools;28.0.3"`

`sdkmanager platform-tools "platforms;android-28"`

`sdkmanager platform-tools "extras;android;m2repository"`

**Cocoapods**

Many of the packages and libraries used in Flutter are accessed through Cocoapods. To install Cocoapods, it’s recommended to use Ruby. Ruby can once again be installed via Homebrew.

`brew install ruby //Installs Ruby`

`sudo gem install cocoapods //Installs Cocoapods`

**Fastlane**

To build and export iOS IPAs, this Jenkins pipeline will use Fastlane. Fastlane can be installed via the below Homebrew command.

`brew install fastlane`

With all these libraries and frameworks installed, we can move on to installing Jenkins, running a Jenkins instance on MacOS, and adding the necessary Jenkins plugins for our pipeline! This concludes Part 1 of this 4 part series on Implementing a Flutter CI/CD Pipeline in Jenkins. Part 2 covers Jenkins Instance Setup.

Published by Steven Foskett in [Android](https://blog.bottlerocketstudios.com/tag/android), [iOS](https://blog.bottlerocketstudios.com/tag/ios), [Technology](https://blog.bottlerocketstudios.com/tag/technology), [App Development](https://blog.bottlerocketstudios.com/tag/app-development), [Flutter](https://blog.bottlerocketstudios.com/tag/flutter)

- <http://www.facebook.com/sharer/sharer.php?u=https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup>
- <https://twitter.com/intent/tweet?url=https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup&text=Implementing%20a%20Flutter%20CI/CD%20Pipeline%20in%20Jenkins:%20Part%201%20(Introduction,%20Strategy,%20and%20Environment%20Setup)>
- <http://www.linkedin.com/shareArticle?mini=true&url=https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup>

[![BottleRocket_Logotype_RGB_®](https://blog.bottlerocketstudios.com/hs-fs/hubfs/_Branding/logos/BottleRocket_Logotype_RGB_%C2%AE.png?width=107&name=BottleRocket_Logotype_RGB_%C2%AE.png)](https://www.bottlerocketstudios.com/)

#### We help companies grow through digital + physical + human experiences.

 

- EXPLORE 
    - [Work](https://www.bottlerocketstudios.com/work)
    - [Practices](https://www.bottlerocketstudios.com/practices)
    - [About](https://www.bottlerocketstudios.com/about)
    - [News & Views](https://blog.bottlerocketstudios.com)
    - [Careers﻿](https://www.bottlerocketstudios.com/careers)
    - [Contact](https://www.bottlerocketstudios.com/contact)
    - [Liftoff Podcast](https://www.bottlerocketstudios.com/liftoff)
    - [After The Glass Breaks Podcast](https://www.bottlerocketstudios.com/after-the-glass-breaks)
- FOLLOW 
    - [Facebook](https://www.facebook.com/bottlerocketstudios/)
    - [Twitter](https://twitter.com/_BottleRocket)
    - [﻿Instagram](https://www.instagram.com/_bottlerocket/)
    - [﻿LinkedIn](https://www.linkedin.com/company/bottle-rocket/)
    - [Medium﻿](https://medium.com/rocket-fuel)
    - [YouTube](https://www.youtube.com/user/BottleRocketApps)
- LEGAL 
    - [App Support](https://www.bottlerocketstudios.com/app-support)
    - [Privacy Policy﻿](https://www.bottlerocketstudios.com/privacy-policy)

© 2022 Bottle Rocket. All Rights Reserved.

![](https://px.ads.linkedin.com/collect/?pid=1680722&fmt=gif)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Steven Foskett",
    "url" : "https://blog.bottlerocketstudios.com/author/steven-foskett"
  },
  "dateModified" : "2021-06-16T06:31:53.002Z",
  "datePublished" : "2020-07-10T16:26:00.000Z",
  "headline" : "Implementing a Flutter CI/CD Pipeline in Jenkins: Part 1 (Introduction, Strategy, and Environment Setup) | Bottle Rocket",
  "image" : [ "https://blog.bottlerocketstudios.com/hubfs/Imported_Blog_Media/Flutter_1-3.jpg" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.bottlerocketstudios.com/implementing-a-flutter-ci-cd-pipeline-in-jenkins-part-1-introduction-strategy-and-environment-setup",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.bottlerocketstudios.com/hubfs/_Branding/logos/BottleRocket_Logotype_RGB_%C2%AE-1.png"
    },
    "name" : "Bottle Rocket"
  }
}
```