Skip to content

Commit

Permalink
feat: 安卓平台混淆设置
Browse files Browse the repository at this point in the history
  • Loading branch information
wkl007 committed Jun 16, 2021
1 parent db400e1 commit 7e64d97
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
12 changes: 7 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
ndk {
// abiFilters "armeabi-v7a", "arm64-v8a", "x86_64", "x86"
abiFilters "armeabi-v7a", "arm64-v8a", "x86_64", "x86"
// TODO 只打包flutter所支持的架构,flutter没有armeabi架构的so,加x86的原因是为了能够兼容模拟器
abiFilters "armeabi-v7a" // release 时只打"armeabi-v7包
// abiFilters "armeabi-v7a" // release 时只打"armeabi-v7包
}
}

Expand All @@ -64,9 +64,11 @@ android {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
//关闭混淆
minifyEnabled false // 删除无用代码
shrinkResources false // 删除无用资源
// 开启混淆
minifyEnabled true // 启用代码混淆、压缩APK
shrinkResources true // 删除无用资源
useProguard true // 代码压缩设置
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // 混淆文件
signingConfig signingConfigs.release
}
}
Expand Down
20 changes: 20 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Flutter Wrapper
-dontwarn io.flutter.**
-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.** { *; }
#友盟
-keep class com.umeng.** {*;}
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep public class [com.wkl.flutter_trip].R$*{
public static final int *;
}

0 comments on commit 7e64d97

Please sign in to comment.