1、检查App Manifest 更改应用名称和应用图标 <app dir>/android/app/src/main/AndroidManifest.xml //是用来设置所有activity属于哪个application的,默认是android.app.Application。 android:name='io.flutter.app.FlutterApplication' android:icon='@mipmap/ic_launcher'>
2、查看构建配置 <app dir>/android/app/build.gradle applicationId: 指定始终唯一的 (Application Id)appid versionCode & versionName: 指定应用程序版本号和版本号字符串。 minSdkVersion & targetSdkVersion: 指定最低的API级别以及应用程序设计运行的API级别。
3、添加启动图标 <app dir>/android/app/src/main/res/mipmap-**** 4、app签名 1)、创建keystore 如果存在keystore请跳至下一步。 keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key 改为 keytool -genkey -v -keystore e:\key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key 2)、引用应用程序中的keystore 创建 <app dir>/android/key.properties 文件 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> 3)、gradle中配置签名 <app dir>/android/app/build.gradle def keystorePropertiesFile = rootProject.file('key.properties') def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
// 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 keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] signingConfig signingConfigs.release
5、打包apk flutter build apk 打好包的发布apk位于 <app dir>/build/app/outputs/apk/release/app-release.apk
|