File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 3535** /android /gradlew.bat
3636** /android /local.properties
3737** /android /** /GeneratedPluginRegistrant.java
38+ ** /android /key.properties
3839
3940# iOS/XCode related
4041** /ios /** /* .mode1v3
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ if (flutterVersionName == null) {
2424apply plugin : ' com.android.application'
2525apply from : " $flutterRoot /packages/flutter_tools/gradle/flutter.gradle"
2626
27+ // 密钥
28+ def keystorePropertiesFile = rootProject. file(" key.properties" )
29+ def keystoreProperties = new Properties ()
30+ keystoreProperties. load(new FileInputStream (keystorePropertiesFile))
31+
2732android {
2833 compileSdkVersion 28
2934
@@ -40,12 +45,26 @@ android {
4045 versionName flutterVersionName
4146 testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
4247 }
43-
48+ // 配置安卓打包
49+ signingConfigs {
50+ release {
51+ keyAlias keystoreProperties[' keyAlias' ]
52+ keyPassword keystoreProperties[' keyPassword' ]
53+ storeFile file(keystoreProperties[' storeFile' ])
54+ storePassword keystoreProperties[' storePassword' ]
55+ }
56+ }
4457 buildTypes {
4558 release {
4659 // TODO: Add your own signing config for the release build.
4760 // Signing with the debug keys for now, so `flutter run --release` works.
48- signingConfig signingConfigs. debug
61+ // signingConfig signingConfigs.debug
62+ // 正式环境打包,配置混淆压缩
63+ signingConfig signingConfigs. release
64+ minifyEnabled true
65+ useProguard true
66+
67+ proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
4968 }
5069 }
5170}
Original file line number Diff line number Diff line change 1+ #Flutter Wrapper
2+ -keep class io.flutter.app.** { *; }
3+ -keep class io.flutter.plugin.** { *; }
4+ -keep class io.flutter.util.** { *; }
5+ -keep class io.flutter.view.** { *; }
6+ -keep class io.flutter.** { *; }
7+ -keep class io.flutter.plugins.** { *; }
You can’t perform that action at this time.
0 commit comments