Skip to content

Commit a5ce816

Browse files
authored
fix: add proguard rules for mihon extensions (#56)
1 parent 6b98e25 commit a5ce816

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

app/proguard-rules.pro

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,58 @@
2525
-keep class org.jsoup.parser.Tag
2626
-keep class org.jsoup.internal.StringUtil
2727

28+
# Mihon/Tachiyomi extension rules
29+
# Disable shrinking and optimization for the core bridge to ensure ClassLoaders and Injekt work perfectly.
2830

31+
-keep class eu.kanade.tachiyomi.** { *; }
32+
-keep interface eu.kanade.tachiyomi.** { *; }
33+
-keeppackagenames eu.kanade.tachiyomi.**
34+
35+
-keep class uy.kohesive.injekt.** { *; }
36+
-keep interface uy.kohesive.injekt.** { *; }
37+
-keeppackagenames uy.kohesive.injekt.**
38+
-keepclassmembers class uy.kohesive.injekt.** { *; }
39+
40+
-keep class io.github.landwarderer.futon.mihon.** { *; }
41+
-keeppackagenames io.github.landwarderer.futon.mihon.**
42+
43+
# Keep everything related to dynamic loading
44+
-keep class io.github.landwarderer.futon.mihon.ChildFirstPathClassLoader { *; }
45+
-keep public class * extends dalvik.system.PathClassLoader { *; }
46+
-keep public class * extends dalvik.system.BaseDexClassLoader { *; }
47+
48+
# Critical attributes for Kotlin reflection and Injekt
49+
-keepattributes Signature, InnerClasses, EnclosingMethod, AnnotationDefault, *Annotation*, kotlin.Metadata, RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
50+
51+
# Keep Kotlin Metadata class itself
52+
-keep class kotlin.Metadata { *; }
53+
54+
# Prevent stripping of extension entry points in the app
55+
-keep public class * implements eu.kanade.tachiyomi.source.Source
56+
-keep public class * implements eu.kanade.tachiyomi.source.SourceFactory
57+
58+
# Keep common libraries used by extensions
59+
-keep class okhttp3.** { *; }
60+
-keep class okio.** { *; }
61+
-keep class org.jsoup.** { *; }
62+
-keep class rx.** { *; }
63+
-keep class kotlinx.serialization.** { *; }
64+
-keep class kotlin.** { *; }
65+
-keep class kotlinx.coroutines.** { *; }
66+
-keeppackagenames okhttp3.**, okio.**, org.jsoup.**, rx.**, kotlinx.serialization.**, kotlin.**, kotlinx.coroutines.**
67+
68+
# Keep Kotlin standard library facades and internal classes often used by extensions
69+
-keep class kotlin.LazyKt** { *; }
70+
-keep class kotlin.collections.CollectionsKt** { *; }
71+
-keep class kotlin.sequences.SequencesKt** { *; }
72+
-keep class kotlin.text.StringsKt** { *; }
73+
-keep class kotlin.comparisons.ComparisonsKt** { *; }
74+
-keep class kotlin.io.FilesKt** { *; }
75+
-keep class kotlin.jvm.internal.** { *; }
76+
-keep class kotlin.jvm.functions.** { *; }
77+
78+
# Suppress warnings
79+
-dontwarn uy.kohesive.injekt.**
80+
-dontwarn eu.kanade.tachiyomi.**
81+
-dontwarn kotlinx.serialization.**
82+
-dontwarn kotlin.reflect.**

0 commit comments

Comments
 (0)