原文鏈接:http://www.reibang.com/p/dfa518270c9a
第一、Android端打包
簽名步驟:
1.首先找到Studio =====> Build ====>Generate Signed Bundle / APK
2.輸入key Store 存放地址辞槐,設(shè)置密碼展姐,建議存放在項目拨匆,
3.如圖所示:
標(biāo)注1:是存放在項目app下面的密鑰
標(biāo)注2:新建file文件key.properties 存放的是密碼,密鑰,別名
storePassword=111111
keyPassword=111111
keyAlias=flutter
storeFile=../flutter_key_store
標(biāo)注3:新建proguard-rules.pro存放的是 代碼混淆的配置
注意:這個配置要放在/android/app/proguard-rules.pro
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
在 build.gradle 中進(jìn)行配置密鑰和代碼混淆
在build.gradle android 上面進(jìn)行配置
def keystoreProperties =new Properties()
def keystorePropertiesFile =rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
在build.gradle android 里面進(jìn)行配置
signingConfigs{
release{ //設(shè)置密鑰配置 keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) :null storePassword keystoreProperties['storePassword']
}
}
buildTypes{
release{ signingConfig signingConfigs.release //代碼混淆需要添加的 minifyEnabledtrue //資源壓縮設(shè)置 useProguardtrue //代碼壓縮設(shè)置 //讀取代碼壓縮配置文件 proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' }
}
4.直接打包APK