How to release your Flutter app
How to release your Flutter app for iOS
Prerequisites
- Make sure that you’ve covered Apple’s guidelines for releasing an app on the app store.
- Have your app’s icons and launch screens ready.
- Have an Apple Developer account.
Prepare for building
Before you can build and release your app on the App Store, you need to set up a place for it using App Store Connect. But first, you need to register a unique bundle ID for your app. This can be done by logging into your Apple Developer account and following these steps:
- Open the App IDs page.
- Click + to create a new Bundle ID.
- Fill out the needed information: App Name, and Explicit App ID.
- If your app needs specific services, select them and click Continue.
- Review the details and click Register to finish.
Now that we have a unique bundle ID, it’s time to set up a place for your app on the App Store Connect. Log in to the App Store Connect.
- Select My Apps.
- Click + then select New App.
- Fill in your app details and make sure iOS is selected, then click Create.
- From the sidebar, select App Information.
- In the General Information section, select the Bundle ID that you registered above.
Adjust Xcode project settings for release
You’ve set everything up from Apple’s side, and next you’ll adjust your Xcode project’s settings to prepare your app for release. Go ahead and fire up Xcode.
- Open Runner.xcworkspace that is inside your app’s iOS folder.
- From the Xcode project navigator, select the Runner project.
- Then, select the Runner target in the main view sidebar.
- Go to the General tab.
- In the Identity section, fill out the information and make sure the Bundle Identifier is the one registered on App Store Connect.
- In the Signing section, make sure Automatically manage signing is checked and select your team.
- Fill out the rest of the information as needed.
- Next, you’ll update your app’s icon. This can be done by selecting Assets.xcassets in the Runner folder from Xcode’s project navigator.
Build and upload your app
At this point, all the settings have been updated for release and there is a placeholder ready on App Store Connect, which means you can build and release.
- From the command line, run
flutter build ios
- Then go back to Xcode and reopen Runner.xcworkspace
- Select Product -> Scheme -> Runner.
- Select Product -> Destination -> Generic iOS Device.
- Select Product -> Archive to produce a build archive.
- From the Xcode Organizer window, select your iOS app from the sidebar, then select the build archive you just produced.
- Click the Validate… button to build.
- Once the archive is successfully validated, click Upload to App Store….
Back on App Store Connect, check the status of your build from the Activities tab. Once it’s ready to release:
- Go to Pricing and Availability and fill out the required information.
- From the sidebar, select the status.
- Select Prepare for Submission and complete all required fields.
- Click Submit for Review.
That’s it! Your app will now be uploaded to the App Store. Apple will review your app before releasing and keep you updated on the status of your app.
How to release your Flutter app for Android
Prerequisites
- Have an Android app ready for release.
- Add a launcher icon and have all your app’s assets ready.
Prepare for release
Before you can publish your Flutter app to Google Play, the app needs a digital signature.
If you don’t already have a keystore, create one
On Mac, use the following command:
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
On Windows, use the following command:
keytool -genkey -v -keystore c:/Users/USER_NAME/key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
Create a file named /android/key.properties that will reference your keystore, it will look like this:
storePassword= keyPassword= keyAlias=key
storeFile=/key.jks>
Configure signing in Gradle
You will find your Gradle file at /android/app/build.gradle. Start editing and follow these steps:
Replace:
android {
With the keystore information that we just created:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
Then, replace:
content_copy
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now,
// so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
With the signing configuration info:
content_copy
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
- Then, go to the defaultConfig block.
- Enter a final unique applicationId.
- Give your app a versionName and versionCode.
- Specify the minimum SDK API level that the app needs to run.
You have now configured your app’s Gradle file and your release builds will be signed automatically.
Review the app manifest and make sure everything is ready
The file AndroidManifest.xml will be located in /android/app/src/main. Open it and review the values and permissions you need before building.
Build and release the app
Now you’ll build your app’s APK so it can be uploaded to the Google Play Store. Go to your command line and follow these steps:
- Enter
cd
- Run
flutter build apk
If everything goes well, you will have an APK ready at /build/app/outputs/apk/release/app.apk
Publish to the Google Play Store
Your app is ready! Next, follow this step-by-step guide to uploading an APK to the Google Play Store.
Comments
Post a Comment