I get this error when building for release. This happens for release only. The error doesn't appear for debuggable or when I set the flag -dontobfuscate How can I tell which classes are being stripped?
java.lang.ExceptionInInitializerError
at androidx.fragment.app.FragmentHostCallback.<init>(SourceFile:4)
at androidx.fragment.app.FragmentHostCallback.<init>(SourceFile:2)
at androidx.fragment.app.FragmentActivity$HostCallbacks.<init>(SourceFile:2)
at androidx.fragment.app.FragmentActivity.<init>(SourceFile:2)
at androidx.appcompat.app.AppCompatActivity.<init>(SourceFile:1)
at main.MainActivity.<init>(SourceFile:1)
Caused by: java.lang.RuntimeException: Shaking error: Missing method in androidx.fragment.app.FragmentManager: void <clinit>()
at androidx.fragment.app.FragmentManager.<clinit>(Unknown Source:9)
at androidx.fragment.app.FragmentHostCallback.<init>(SourceFile:4)
at androidx.fragment.app.FragmentHostCallback.<init>(SourceFile:2)
at androidx.fragment.app.FragmentActivity$HostCallbacks.<init>(SourceFile:2)
at androidx.fragment.app.FragmentActivity.<init>(SourceFile:2)
at androidx.appcompat.app.AppCompatActivity.<init>(SourceFile:1)
at main.MainActivity.<init>(SourceFile:1)
Proguard rules configuration
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepattributes *Annotation*
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}
-if @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
}
-keepclassmembers class <1> {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}
-keep @kotlinx.android.parcel.Parcelize public class *
-keep @kotlinx.parcelize.Parcelize public class *
-keep class retrofit2.** { *; }
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
And this is my gradle file configuration
defaultConfig {
minSdk 24
targetSdk 32
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Thanks