Skip to content

Commit 7192176

Browse files
committed
Try adding consumer-rules and proguard-rules
1 parent 32a7efe commit 7192176

File tree

2 files changed

+92
-19
lines changed

2 files changed

+92
-19
lines changed

OpacityCore/consumer-rules.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-keep class com.opacitylabs.opacitycore.** { *; }
2+
-keepclassmembers class com.opacitylabs.opacitycore.** { *; }

OpacityCore/proguard-rules.pro

Lines changed: 90 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,93 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
1+
# Keep all public API classes and methods - this is your main library interface
2+
-keep public class com.opacitylabs.opacitycore.** {
3+
public *;
4+
}
5+
6+
# Keep the main OpacityCore object and all its methods (including native methods)
7+
-keep class com.opacitylabs.opacitycore.OpacityCore {
8+
<fields>;
9+
<methods>;
10+
native <methods>;
11+
}
12+
13+
# Keep data classes and response models
14+
-keep class com.opacitylabs.opacitycore.OpacityResponse { *; }
15+
-keep class com.opacitylabs.opacitycore.OpacityError { *; }
16+
17+
# Keep the InAppBrowserActivity as it's referenced by string name
18+
-keep class com.opacitylabs.opacitycore.InAppBrowserActivity { *; }
19+
20+
# Keep utility classes
21+
-keep class com.opacitylabs.opacitycore.JsonUtils { *; }
22+
-keep class com.opacitylabs.opacitycore.JsonToAnyConverter { *; }
23+
-keep class com.opacitylabs.opacitycore.JsonToAnyConverter$Companion { *; }
24+
-keep class com.opacitylabs.opacitycore.CryptoManager { *; }
25+
-keep class com.opacitylabs.opacitycore.CookieResultReceiver { *; }
26+
27+
# Keep all enums and their methods
28+
-keepclassmembers enum com.opacitylabs.opacitycore.** {
29+
public static **[] values();
30+
public static ** valueOf(java.lang.String);
31+
**[] $VALUES;
32+
}
33+
34+
# Keep companion objects (especially for OpacityCore object)
35+
-keep class com.opacitylabs.opacitycore.**$Companion { *; }
36+
37+
# Keep Kotlin serialization support
38+
-keep @kotlinx.serialization.Serializable class com.opacitylabs.opacitycore.** { *; }
39+
-keepattributes *Annotation*, InnerClasses
40+
-dontnote kotlinx.serialization.AnnotationsKt
41+
-dontnote kotlinx.serialization.SerializationKt
42+
43+
# Keep Kotlin metadata for reflection
44+
-keepattributes RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeVisibleTypeAnnotations
45+
46+
# Keep all constructors
47+
-keepclassmembers class com.opacitylabs.opacitycore.** {
48+
<init>(...);
49+
}
50+
51+
# Keep methods that might be called via reflection or JNI
52+
-keepclassmembers class com.opacitylabs.opacitycore.** {
53+
public <methods>;
54+
private <methods>;
55+
}
56+
57+
# Keep native methods (important for JNI)
58+
-keepclasseswithmembernames class * {
59+
native <methods>;
60+
}
61+
62+
# Keep classes that extend Android components
63+
-keep class * extends android.app.Activity
64+
-keep class * extends android.content.BroadcastReceiver
65+
-keep class * extends android.os.Parcelable
66+
67+
# Keep GeckoView related classes (since you use Mozilla GeckoView)
68+
-keep class org.mozilla.geckoview.** { *; }
69+
-dontwarn org.mozilla.geckoview.**
70+
71+
# Keep security crypto classes
72+
-keep class androidx.security.crypto.** { *; }
73+
-dontwarn androidx.security.crypto.**
74+
75+
# Keep JSON handling classes
76+
-keep class org.json.** { *; }
77+
-dontwarn org.json.**
78+
79+
# Keep coroutines support
80+
-keep class kotlinx.coroutines.** { *; }
81+
-keep class kotlin.coroutines.** { *; }
82+
83+
# Keep Kotlin standard library
84+
-keep class kotlin.** { *; }
85+
-keep class kotlin.Metadata { *; }
86+
-dontwarn kotlin.**
87+
88+
# Preserve line number information for debugging stack traces
89+
-keepattributes SourceFile,LineNumberTable
1890

1991
# If you keep the line number information, uncomment this to
2092
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
22-
-keep class com.opacitylabs.opacitycore.OpacityResponse { *; }
93+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)