Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config proguard and r8 with rules #199

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
getByName("debug") {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".debug"
versionNameSuffix = "-debug"
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down
61 changes: 60 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,63 @@

# 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 { *; }

-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.**

-dontwarn reactor.blockhound.**
Loading