Ready to work
1 App signature creation keystore
If you already have your keystore adjusted to the next step
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
2 Create key.properties
Works within the android
folder to create a new key.properties
file for the key database references:
storePassword=store的密码
keyPassword=key的密码
keyAlias=key
storeFile=#本地key.jks文件的绝对路径,例:/Users/xxxx/key.jks#
Map
3 configuration signature in gradle
路径/android/app/build.gradle
- Original code
android {
change:
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
- Original code
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
}
}
change to:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Packaging execute the command:
flutter build apk
If the package when Error:Execution failed for task ':app:lintVitalRelease'.
the lintOptions
content changes following code:
lintOptions {
checkReleaseBuilds false
abortOnError false
}
Packaged release apk is located/build/app/outputs/apk/app-release.apk。
Real machine installation
USB connection with your Android device to your computer
cd.
Runflutter install
Reference: " released on Android APP "
Reproduced in: https: //www.jianshu.com/p/d71b8c181900