《dart笔记》
摘要
一些示例说明
多环境打包
- 创建多个main配置config写入静态变量 忽略空安全
1
flutter build apk -t lib/main_develop.dart --no-sound-null-safety
- 通过参数读取参数执行
1
2--dart-define=channel_name=1
String.fromEnvironment('channel_name', defaultValue: 'unknown') - 打包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25生成签名
keytool -genkey -v -keystore /D:/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
配置build.gradle
位置app/build.gradle
signingConfigs {
release {
keyAlias 'key'
keyPassword 'cxcwapk'
storeFile file('key/sign.jks')
storePassword 'cxcwapk'
}
}
android根目录配置key.properties
storePassword=cxcwapk
keyPassword=cxcwapk
keyAlias=sign
storeFile=key/sign.jks
修改defaultConfig.applicationId:"独一无二"
配置logo
flutter pub run flutter_launcher_icons:main
flutter build apk -t lib/main_develop.dart --no-sound-null-safety