React Native Increment Build Number with Fastlane in ios/android

Vanderson Vauruk
4 min readNov 6, 2021

--

I had a problem with auto-increment in a project, for my client.

And I learned about, looking for a solution, I found one then decided to write about my experience. I’m writing this article pretty simple to understand.

My environment:

— Ventura 13.3.1

— Xcode 14.2

— Android Studio Flamingo — 2022.2.1 Patch 1(Arm64)

— Ruby (ruby 2.7.4p191 (2021–07–07 revision a21a3b7d23) [arm64-darwin22])

— Java (openjdk 17.0.6 2023–01–17)

— Node 18.12.1

— Fastlane 2.212.2

First of all, use this Fastlane procedure from to start in iOS/Android section:

After your first build, now to go add increment iOS and Android:

Fastlane Increment in iOS First:

iOS

For iOS is more simple, in this link we have a description option in this SO.

After to create your first project with: fastlane init

This file is Fastfile (ios), which worked for me, in iOS not is necessary to install any plugins when we used Macbook.

Fastfile in Github:

After this file did to configurate, we’re ready to start publishing our app:

$ cd ios

This line below, make a build, and publish

$ fastlane beta

After which published with Fastlane, that is the result

For iOS that is it.

Note:

if you are using M1 with BigSur 12.3.1 with Xcode 13.3.1, maybe has this error:

an error occurred while installing json (2.6.1), and bundler cannot continue.

I solved this problem using this procedure:

1 — brew update andsudo brew update.

2 — brew install rbenv

3 — Put on Xcode 12 how Default .

3.1 — sudo rm -rf /Library/Developer/CommandLineTools ... remove the commandLineTools

3.2 — sudo xcode-select --install ... install again with Xcode 12 — commandLineTools to BigSur

3.3 — brew install rbenv

4 — rbenv init

5 — bundler install

Make now our Fastfile (Android), this way worked for me:

Text FastFile Android:

After this file is configurated, we’re ready start to publishing our app:

Before publishing /android/app/build.gradle stays like this:

$ cd android

This line below, make a build and publish

$ fastlane beta

After publishing is ok, /android/app/build.gradle stays like this:

All procedures in iOS and Android we mace auto increment in both information in iOS (Version/Build) and Android (versionCode/versionName), but if you don’t want that it like this, you can comment on the related lines or change it to need.

I hope I have helped, if you need more help send me a message, thank you!

--

--

Vanderson Vauruk

I’m Senior Mobile Developer, i working how programer since 2007, i had a startup with focus in IoT, i like learn and share may knowledge another people.