Skip to content

Commit

Permalink
config proguard and r8 with rules
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiAbbasian committed Feb 9, 2024
1 parent ba6f05e commit 21e9184
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
64 changes: 63 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,66 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-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 <init>(...);
}
-keepclasseswithmembers class * {
@javax.inject.Inject <init>(...);
}
-keepclassmembers class **.R$* {
public static <fields>;
}
-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 <init>(...);
}
-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.**

0 comments on commit 21e9184

Please sign in to comment.