In this tutorial guide, we will show you how to use Shorebird to update Flutter Android apps. We will cover the following topics:
- Installing Shorebird
- Integrating Shorebird with your Flutter app
- Pushing code and assets to your app
- Testing your app updates
It includes features for managing and performing code pushes, as well as other aspects of app deployment and maintenance.
Shorebird is a new cloud service that makes it easy to update Flutter Android apps instantly. With Shorebird, you can push new code and assets to your app without having to go through the app store. This means that you can fix bugs and add new features to your app in minutes, not days.
Shorebird is a command line interface (CLI) that is intended to be used anywhere from the flutter. It includes features for managing and performing code pushes, as well as app deployment and maintenance.
code push is the ability to update an application’s code without requiring the user to download and install a new version of the app from the play store or app store.
You can integrate code push functionality into your Flutter app and push updates to your users’ devices using Shorebird CLI.
This allows you to fix bugs, add new features, or change code. without requiring users to go through the app store update process.
As we all know, code push is the ability to automatically update an application’s code without requiring the user to download and install a new version of the app from the play store or app store.
You can integrate code push functionality into your Flutter app and push updates to your users’ devices using Shorebird CLI.
This allows you to fix bugs, add new features, or change code without requiring users to go through the app store update process.
Starting throughout
To install Shorebird on your local machine, follow these steps.
Before running the Shorebird CLI, check to see if your local device has Git installed. If not, proceed with the Git download and installation.
The Shorebird CLI will be installed and added to your PATH in your local device’s ~/.shorebird/bin directory. It also includes a Shorebird-specific version of Flutter and Dart inside ~/.shorebird/bin/cache/flutter.
Mac / Linux
curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash
If above command is not working for your linux terminal try this command :
curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash -s -- --force
Window
powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr -UseBasicParsing 'https://raw.githubusercontent.com/shorebirdtech/install/main/install.ps1'|iex"
You can now verify that everything is in order and that the installation process has been completed. By Running
shorebird doctor
The status of the shorebird version and flutter version differs from what we have on our local machine, according to Shorebird Doctor. Which we previously set up. This isn’t a big deal for us because we already manage the FVM and know what SDK version Shorebird is using.
Signup to Shorebird
shorebird account create
You can use the above command to sign up for Shorebird directly from the terminal, or you can go through the official site’s create account section. After completing the signup process, proceed to the login section.
Login to Shorebird
shorebird login
Following this command are the Google OAuth2 instructions. Please proceed accordingly. After completing the command on the terminal, you will see a verify link. Follow the link and confirm that it is you. You can now close that window.
Now that everything is in place, we can begin shipping and patching our apps with Shorebird.
Shorebird initialize
Note: Open terminal from your project main Folder to initialize related project to Shorebird
shorebird init
This does three things:
- This instructs Shorebird to generate a unique app_id for your app. Shorebird uses this app_id to identify your app and determine which updates to send to it. It is not necessary to keep it hidden.
- Creates a shorebird.yaml file in the root directory of your project. The app_id mentioned above can be found in shorebird.yaml.
- ensuring that the shorebird.yaml file is bundled with your app’s assets and available to the Shorebird updater at runtime.
After successfully initialising the Shorebird on your project, you should see something like this on your Shorebird console.
Release for Android
shorebird release android
If your application supports flavours or multiple release targets, you can use the –flavour and –target options to specify the flavour and target:
shorebird release --target ./lib/main_development.dart --flavor development
Shorebird release Android creates an AppBundle (.aab) by default. To create an Android Package Kit (.apk), execute the following command:
shorebird release android --artifact apk
If shorebird release android not working properly try force command :
shorebird release android --force
Preview of Release
If you want to check preview of your work on your android devices or emulator try this command :
shorebird preview
Push update
Once your app has been released, you can use the shorebird patch android command to push updates:
shorebird patch android
The above command accomplishes a number of tasks, including
- Creates the update artifacts.
- Downloads the relevant release artifacts.
- Creates a patch based on the difference between the release and the current changes.
- The patch artefacts are uploaded to the Shorebird backend.
- The patch is moved to the stable channel.
Note
if the jks file for the patch request was not found on your local machine. It will notify you by displaying a terminal message or a success message.
Shorebird does not currently support iOS devices; however, we will be able to send iOS build and patch requests via shorebird very soon. For the time being, we can continue working on Android devices.