-
Check the App Manifest
-
Checking the build configuration
-
Add a startup icon
The above steps can be viewed in detail in the official document to release the Android version of the APP. The document is very detailed and will not be described here.
-
App signature
To create the keystore
Running in Android Studio Terminal:
flutter doctor -v
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
The command | introduce |
---|---|
-genkey | Create a key.jks file in the user home directory |
-v | Displays certificate details in the keystore |
-alias | Produce an alias |
-keyalg | Specifies the algorithm for the key |
-keystore | Specifies the name of the keystore (the generated information will not be in the. JKS file |
-validity | Specifies how many days the created certificate is valid |
-keysize | Specify key length |
The key library password must be remembered!
JKS file will be generated in the root directory of drive D. Remember: do not share this JKS file with anyone!! Don’t share this JKS file with anyone!! Don’t share this JKS file with anyone!! Especially in order to facilitate the source code into github XX.
Reference the keystore in the application
Create a named app dir/android/key. The properties of the file, which contains references to the key library:
storePassword= password from previous step keyPassword= password from previous step keyAlias= key storeFile= location of the key store file, e.g. /Users/user name/key.jks
The command | introduce |
---|---|
storePassword | Keystore password |
keyPassword | The key password |
keyAlias | The key alias |
storeFile | JKS file path |
Note: Keep files private; Do not add it to common source control
Configure signatures in Gradle
By editing/android/app/build. Gradle signature configuration file for your application
1. Replace: android {is:
def keystorePropertiesFile = rootProject.file("key.properties") def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) android {
(2) replacement:
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 } }
To:
signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release } }
The release version of your application will now be automatically signed.
Build a Release APK This section describes how to build a Release APK. If you complete the signing steps in the previous section, the APK is signed.
Using the command line:
CD (for your project directory). Run the flutter build apk (flutter build contains the –release option by default). Packaged good release APK is located at/build/app/outputs/APK/app – the APK.
Install the distribution APK on devices Follow these steps to install the APK built in the previous step on connected Android devices
Using the command line:
Connect your Android device to your computer using a USB CD. Run flutter Install.