graphql + flutter

[flutter] android 배포시 암호화

으누아빠 2024. 2. 4. 00:31
반응형

1. andorid/app/proguard-rules.pro 생성

 

2. 아래 코드 삽입
https://github.com/flutter/flutter/issues/78625#issuecomment-804164524
#-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 cohttp://m.google.android.play.core.splitcompat.SplitCompatApplication
-keep class cohttp://m.google.android.play.core.splitcompat.SplitCompatApplication { *; }
-keep class cohttp://m.google.android.play.core.splitinstall.SplitInstallService
-keep class cohttp://m.google.android.play.core.splitinstall.SplitInstallService { *; }
-keep class cohttp://m.kakao.sdk.**.model.* { <fields>; }
# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
-dontwarn io.flutter.embedding.**
-dontwarn org.videolan.R$id


3.android/app/build.gradle 에 buildType 수정

    buildTypes {
        release {
            // 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
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }