From 21e91847fc5627f440023670bad2e4f6e11b8432 Mon Sep 17 00:00:00 2001 From: mahdiabbasian Date: Fri, 9 Feb 2024 22:22:37 +0330 Subject: [PATCH 1/2] config proguard and r8 with rules --- app/build.gradle.kts | 9 +++++- app/proguard-rules.pro | 64 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e6991a22..363a492c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,8 +16,15 @@ android { } } buildTypes { - val release by getting { + val debug by getting { isMinifyEnabled = false + isShrinkResources = false + applicationIdSuffix = ".debug" + versionNameSuffix = "-debug" + } + val release by getting { + isMinifyEnabled = true + isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index ff59496d..63928d07 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,66 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep class * extends android.app.Activity { *; } +-keep class * extends androidx.fragment.app.Fragment { *; } +-keep class * extends android.app.Service { *; } +-keep class * extends android.content.BroadcastReceiver { *; } +-keep class * extends android.content.ContentProvider { *; } +-keep class androidx.navigation.NavArgs { *; } +-keepclasseswithmembers class * { + @androidx.lifecycle.ViewModelInject (...); +} +-keepclasseswithmembers class * { + @javax.inject.Inject (...); +} +-keepclassmembers class **.R$* { + public static ; +} +-keepclassmembers class * { + @androidx.compose.ui.tooling.preview.Preview *; +} +-keepattributes *Annotation* + +-keep class * extends androidx.compose.runtime.Composable { *; } +-keepclasseswithmembers class * { + @androidx.compose.ui.tooling.preview.Preview *; +} + +-keepclassmembers class * { + @javax.inject.Inject (...); +} +-keepclassmembers class * { + @dagger.hilt.android.lifecycle.HiltViewModel *; +} +-keep,@dagger.hilt.InstallIn class * { *; } +-keep class dagger.hilt.** { *; } +-dontwarn dagger.internal.codegen.ComponentProcessor + +-keep class retrofit2.** { *; } +-keep class okhttp3.** { *; } +-keep class com.squareup.okhttp3.** { *; } +-keep class * implements retrofit2.CallAdapter.Factory { *; } +-keep class * implements retrofit2.Converter.Factory { *; } +-keepattributes Signature +-keepattributes Exceptions + +-keep class kotlinx.serialization.** { *; } +-keepclassmembers class * { + @kotlinx.serialization.Serializable *; +} +-keepattributes *Annotation*, InnerClasses +-dontnote kotlinx.serialization.AnnotationsKt + +-keep class ir.composenews.db.** { *; } +-keep interface ir.composenews.db.** { *; } + +-keep class io.kotest.** { *; } +-dontwarn io.kotest.** + +-keep class kotlinx.coroutines.test.** { *; } +-dontwarn kotlinx.coroutines.test.** + +-dontwarn java.lang.management.** +-dontwarn reactor.blockhound.** \ No newline at end of file From 06a8bf1d361ac58088a505f34dcbfca94dd65460 Mon Sep 17 00:00:00 2001 From: mahdiabbasian Date: Sat, 10 Feb 2024 15:41:33 +0330 Subject: [PATCH 2/2] fix ci issues --- app/build.gradle.kts | 4 ++-- app/proguard-rules.pro | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 363a492c..0189551c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,13 +16,13 @@ android { } } buildTypes { - val debug by getting { + getByName("debug") { isMinifyEnabled = false isShrinkResources = false applicationIdSuffix = ".debug" versionNameSuffix = "-debug" } - val release by getting { + getByName("release") { isMinifyEnabled = true isShrinkResources = true proguardFiles( diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 63928d07..a0900546 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -26,12 +26,14 @@ -keep class * extends android.content.BroadcastReceiver { *; } -keep class * extends android.content.ContentProvider { *; } -keep class androidx.navigation.NavArgs { *; } + -keepclasseswithmembers class * { @androidx.lifecycle.ViewModelInject (...); } -keepclasseswithmembers class * { @javax.inject.Inject (...); } + -keepclassmembers class **.R$* { public static ; } @@ -41,13 +43,7 @@ -keepattributes *Annotation* -keep class * extends androidx.compose.runtime.Composable { *; } --keepclasseswithmembers class * { - @androidx.compose.ui.tooling.preview.Preview *; -} --keepclassmembers class * { - @javax.inject.Inject (...); -} -keepclassmembers class * { @dagger.hilt.android.lifecycle.HiltViewModel *; } @@ -75,9 +71,10 @@ -keep class io.kotest.** { *; } -dontwarn io.kotest.** - -keep class kotlinx.coroutines.test.** { *; } -dontwarn kotlinx.coroutines.test.** -dontwarn java.lang.management.** +-dontwarn reactor.blockhound.** + -dontwarn reactor.blockhound.** \ No newline at end of file