flutter android 混淆

原文鏈接:http://www.itdecent.cn/p/dfa518270c9a

第一、Android端打包

簽名步驟:

1.首先找到Studio =====> Build ====>Generate Signed Bundle / APK

image

2.輸入key Store 存放地址,設(shè)置密碼,建議存放在項(xiàng)目,

image

3.如圖所示:

image

標(biāo)注1:是存放在項(xiàng)目app下面的密鑰

標(biāo)注2:新建file文件key.properties 存放的是密碼,密鑰,別名

storePassword=111111

keyPassword=111111

keyAlias=flutter

storeFile=../flutter_key_store

標(biāo)注3:新建proguard-rules.pro存放的是 代碼混淆的配置

注意:這個(gè)配置要放在/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

image
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容