Skip to content

Commit 068be1d

Browse files
committed
feat: R8 난독화 및 리소스 축소 활성화
릴리즈 빌드에 minifyEnabled true, shrinkResources true 적용. 공식 문서 기반 ProGuard rules 작성 (Firebase Crashlytics, Kakao SDK, Gson). AAB 용량 54MB → 46.8MB (14% 감소).
1 parent 9cde977 commit 068be1d

2 files changed

Lines changed: 25 additions & 23 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ android {
6363

6464
buildTypes {
6565
release {
66-
minifyEnabled false
66+
minifyEnabled true
67+
shrinkResources true
6768
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
6869
signingConfig signingConfigs.release
6970
}

app/proguard-rules.pro

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
1+
# ===========================
2+
# Runnect ProGuard/R8 Rules
3+
# ===========================
4+
# 각 라이브러리의 공식 문서 또는 공식 저장소에 근거한 규칙만 포함합니다.
5+
# consumer rules로 자동 적용되는 라이브러리는 별도 규칙을 추가하지 않습니다.
6+
# (Retrofit, OkHttp, Kotlin Serialization, Glide, Naver Map SDK, DataBinding, Hilt)
77

8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
8+
# --- Firebase Crashlytics ---
9+
# 난독화된 스택 트레이스를 읽을 수 있도록 소스 파일명/라인 번호 유지
10+
# 공식 문서: https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android
11+
-keepattributes SourceFile,LineNumberTable
12+
-keep public class * extends java.lang.Exception
13+
-renamesourcefileattribute SourceFile
1414

15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
22-
23-
# https://developers.kakao.com/docs/latest/en/getting-started/sdk-android#configure-for-shrinking-and-obfuscation-(optional)
15+
# --- Kakao SDK ---
16+
# 공식 문서: https://developers.kakao.com/docs/latest/en/android/getting-started#configure-for-shrinking-and-obfuscation-(optional)
2417
-keep class com.kakao.sdk.**.model.* { <fields>; }
25-
-keep class * extends com.google.gson.TypeAdapter
18+
19+
# --- Gson ---
20+
# Gson 2.13.x JAR에 consumer rules가 포함되어 있지 않으므로 수동 추가 필요
21+
# 공식 규칙 파일: https://github.com/google/gson/blob/main/gson/src/main/resources/META-INF/proguard/gson.pro
22+
# 공식 트러블슈팅: https://github.com/google/gson/blob/main/Troubleshooting.md#r8-agp
23+
-keep class * extends com.google.gson.TypeAdapter
24+
-keepclassmembers,allowobfuscation class * {
25+
@com.google.gson.annotations.SerializedName <fields>;
26+
}

0 commit comments

Comments
 (0)