Berikut adalah cara build apk release dari aplikasi android yang dibuat dengan menggunakan flutter.
1. Android Manifest
- Buka android/app/src/AndroidManifest.xml
- Ubah nama package, android:label
2. Ubah icon
Dijelaskan di artikel : Klik Disini
Dijelaskan di artikel : Klik Disini
3. Buat Keystore
Di dalam cmd folder project tulis perintah :
keytool -genkey -v -keystore keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
4. Reference Keystore
Di dalam cmd folder project tulis perintah :
keytool -genkey -v -keystore keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
4. Reference Keystore
- Buat file android/key.proprerties :
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>
5. Ubah Gradle
- Buka android/app/build.gradle
- Ubah defaultConfig:
defaultConfig {
applicationId "id.athalon.hello" //nama package
minSdkVersion 16
targetSdkVersion 27
versionCode 1 //version code
versionName "1.0" //version code
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }
- Ubah bagian ini :
android {
Menjadi :
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
- Ubah bagian ini :
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
Menjadi :
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
6. Jalankan di cmd project
- flutter clean
- flutter build apk
2 Comments
tutorial sesat anjing
ReplyDeletehttps://www.c-sharpcorner.com/article/release-apk-in-flutter/
Delete