|
3 | 3 | # removes such information by default, so configure it to keep all of it. |
4 | 4 | -keepattributes Signature |
5 | 5 |
|
| 6 | +# CRITICAL: Keep generic type information for TypeToken to work properly |
| 7 | +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations |
| 8 | +-keepattributes *Annotation* |
| 9 | + |
6 | 10 | # For using GSON @Expose annotation |
7 | 11 | -keepattributes *Annotation* |
8 | 12 |
|
|
23 | 27 | } |
24 | 28 |
|
25 | 29 | # Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. |
26 | | --keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken |
27 | | --keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken |
| 30 | +# CRITICAL: Do NOT allow obfuscation or shrinking of TypeToken - it needs to preserve generic type information |
| 31 | +-keep class com.google.gson.reflect.TypeToken |
| 32 | +-keep class * extends com.google.gson.reflect.TypeToken |
| 33 | + |
| 34 | +# Keep TypeToken constructors and methods to preserve generic type information |
| 35 | +-keepclassmembers class com.google.gson.reflect.TypeToken { |
| 36 | + <init>(...); |
| 37 | + <methods>; |
| 38 | +} |
| 39 | + |
| 40 | +# Keep all Gson reflection classes that handle generic types |
| 41 | +-keep class com.google.gson.reflect.** { *; } |
| 42 | + |
| 43 | +# CRITICAL: Keep Google Guava TypeToken and TypeCapture classes (used by Gson) |
| 44 | +-keep class com.google.common.reflect.TypeToken { *; } |
| 45 | +-keep class com.google.common.reflect.TypeCapture { *; } |
| 46 | +-keep class com.google.common.reflect.TypeToken$* { *; } |
| 47 | +-keep class com.google.common.reflect.TypeCapture$* { *; } |
| 48 | + |
| 49 | +# Keep all anonymous subclasses of TypeToken (created by object : TypeToken<T>() {}) |
| 50 | +-keep class * extends com.google.common.reflect.TypeToken { *; } |
| 51 | +-keep class * extends com.google.gson.reflect.TypeToken { *; } |
| 52 | + |
| 53 | +# Keep Gson TypeAdapter classes used by Room TypeConverters |
| 54 | +-keep class * extends com.google.gson.TypeAdapter |
| 55 | +-keep class * implements com.google.gson.TypeAdapterFactory |
| 56 | + |
| 57 | +# Keep Room TypeConverters that use Gson (important for complex types like List<SectionScoreDb>) |
| 58 | +-keep @androidx.room.TypeConverter class * { *; } |
| 59 | +-keepclassmembers class * { |
| 60 | + @androidx.room.TypeConverter <methods>; |
| 61 | +} |
| 62 | + |
| 63 | +# Keep generic type information for Room entities with complex types |
| 64 | +-keepclassmembers class org.openedx.**.data.model.room.** { |
| 65 | + <fields>; |
| 66 | + <init>(...); |
| 67 | + * mapToDomain(); |
| 68 | + * mapToRoomEntity(); |
| 69 | + * mapToEntity(); |
| 70 | +} |
| 71 | + |
| 72 | +# CRITICAL: Keep the CourseConverter and all its TypeToken usage |
| 73 | +-keep class org.openedx.course.data.storage.CourseConverter { *; } |
| 74 | +-keepclassmembers class org.openedx.course.data.storage.CourseConverter { |
| 75 | + <init>(...); |
| 76 | + <methods>; |
| 77 | +} |
| 78 | + |
| 79 | +# Keep anonymous TypeToken subclasses created in CourseConverter |
| 80 | +-keep class org.openedx.course.data.storage.CourseConverter$* { *; } |
| 81 | + |
| 82 | +# CRITICAL: Prevent obfuscation of CourseConverter methods that use TypeToken |
| 83 | +-keepclassmembers,allowobfuscation class org.openedx.course.data.storage.CourseConverter { |
| 84 | + @androidx.room.TypeConverter <methods>; |
| 85 | +} |
| 86 | + |
| 87 | +# Keep all TypeConverter classes that use Gson |
| 88 | +-keep class org.openedx.discovery.data.converter.DiscoveryConverter { *; } |
| 89 | + |
| 90 | +# Keep the specific TypeToken usage patterns in TypeConverters |
| 91 | +-keepclassmembers class org.openedx.**.data.storage.** { |
| 92 | + @androidx.room.TypeConverter <methods>; |
| 93 | +} |
| 94 | + |
| 95 | +-keepclassmembers class org.openedx.**.data.converter.** { |
| 96 | + @androidx.room.TypeConverter <methods>; |
| 97 | +} |
28 | 98 | ##---------------End: proguard configuration for Gson ---------- |
29 | 99 |
|
30 | 100 | -keepclassmembers class * extends java.lang.Enum { |
|
33 | 103 | public static ** valueOf(java.lang.String); |
34 | 104 | } |
35 | 105 |
|
| 106 | +##---------------Begin: proguard configuration for Kotlin Coroutines ---------- |
| 107 | +# Keep all coroutine-related classes and methods |
| 108 | +-keep class kotlinx.coroutines.** { *; } |
| 109 | +-keep class kotlin.coroutines.** { *; } |
| 110 | +-keep class kotlin.coroutines.intrinsics.** { *; } |
| 111 | + |
| 112 | +# Keep suspend functions and coroutine builders |
| 113 | +-keepclassmembers class * { |
| 114 | + kotlin.coroutines.Continuation *(...); |
| 115 | +} |
| 116 | + |
| 117 | +# Keep coroutine context and related classes |
| 118 | +-keep class kotlinx.coroutines.CoroutineContext$* { *; } |
| 119 | + |
| 120 | +# Keep Flow and StateFlow classes |
| 121 | +-keep class kotlinx.coroutines.flow.** { *; } |
| 122 | + |
| 123 | +# Keep coroutine dispatchers |
| 124 | +-keep class kotlinx.coroutines.Dispatchers { *; } |
| 125 | +-keep class kotlinx.coroutines.Dispatchers$* { *; } |
| 126 | + |
| 127 | +# Keep coroutine scope and job classes |
| 128 | +-keep class kotlinx.coroutines.CoroutineScope { *; } |
| 129 | +-keep class kotlinx.coroutines.Job { *; } |
| 130 | +-keep class kotlinx.coroutines.Job$* { *; } |
| 131 | + |
| 132 | +# Keep coroutine intrinsics that are causing the error |
| 133 | +-keep class kotlin.coroutines.intrinsics.IntrinsicsKt { *; } |
| 134 | +-keep class kotlin.coroutines.intrinsics.IntrinsicsKt$* { *; } |
| 135 | + |
| 136 | +# Keep suspend function markers |
| 137 | +-keepclassmembers class * { |
| 138 | + @kotlin.coroutines.RestrictsSuspension <methods>; |
| 139 | +} |
| 140 | + |
| 141 | +# Keep coroutine-related annotations |
| 142 | +-keep @kotlin.coroutines.RestrictsSuspension class * { *; } |
| 143 | +##---------------End: proguard configuration for Kotlin Coroutines ---------- |
| 144 | + |
36 | 145 | -dontwarn org.bouncycastle.jsse.BCSSLParameters |
37 | 146 | -dontwarn org.bouncycastle.jsse.BCSSLSocket |
38 | 147 | -dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider |
|
0 commit comments