1.生成key
2.创建key.properties
3.配置app的build.gradle
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
- 命令行执行
flutter build apk
生成的app-release.apk 就在项目的output/apk/release目录下
安装 生成的apk包到手机
adb install app-release.apk