WayFar
Search…
Android

App configuration

Application ID

It is recommended to change the application ID to be sure that you have a unique identifier. Open the file build.gradle located in android/app and update the "applicationId" property in the "defaultConfig" section
The convention for application id is to hold this format: com.<Organization>.<Product>
1
defaultConfig {
2
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3
applicationId "myparking.example.my_parking_v2"
4
minSdkVersion 21
5
targetSdkVersion 30
6
versionCode flutterVersionCode.toInteger()
7
versionName flutterVersionName
8
}
Copied!

Package name

By default the package name should match the application id, so it's recommended to update it accordingly. Open the file AndroidManifest.xml located in android/app/src/main and update the "package" attribute of the root element.
AndroidManifest.xml
1
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
xmlns:tools="http://schemas.android.com/tools"
3
package="myparking.example.my_parking_v2">
4
...
5
</manifest>
Copied!

Signing the app

This step is optional for running and testing the app, it is needed once you want to publish the app and you want to generate a release build.

Create a keystore

To create a keystore, run the following command (Replace [alias_name] by a name of your choice)
1
keytool -genkey -v -keystore keystore.jks -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000
Copied!
After creating a keystore, create a new file key.properties inside android folder, that contains a reference to your keystore:
key.properties
1
storePassword=<password from previous step>
2
keyPassword=<password from previous step>
3
keyAlias=upload
4
storeFile=<location of the key store file>
Copied!

Configure signing in gradle

Edit the file build.gradle in order to use the created keystore:
  1. 1.
    Add the keystore information from your properties file before the android block:
build.gradle
1
def keystoreProperties = new Properties()
2
def keystorePropertiesFile = rootProject.file('key.properties')
3
if (keystorePropertiesFile.exists()) {
4
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
5
}
Copied!
2. Find the buildTypes block, and edit is as the following:
build.gradle
1
signingConfigs {
2
release {
3
keyAlias keystoreProperties['keyAlias']
4
keyPassword keystoreProperties['keyPassword']
5
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
6
storePassword keystoreProperties['storePassword']
7
}
8
}
9
buildTypes {
10
release {
11
signingConfig signingConfigs.release
12
}
13
}
Copied!