Skip to content

Commit 2c97074

Browse files
feat(Wrapper): adds ProGuard rules for Android builds
1 parent 78ab001 commit 2c97074

File tree

1 file changed

+220
-0
lines changed

1 file changed

+220
-0
lines changed

example/android/app/proguard-rules.pro

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,223 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11+
12+
# ========================================
13+
# REACT NATIVE CORE RULES
14+
# ========================================
15+
16+
# Keep all React Native classes to prevent NoSuchMethodError
17+
-keep class com.facebook.react.** { *; }
18+
-keep interface com.facebook.react.** { *; }
19+
-keepclassmembers class com.facebook.react.** { *; }
20+
21+
# Keep React Native dev support classes (fixes CxxInspectorPackagerConnection issues)
22+
-keep class com.facebook.react.devsupport.** { *; }
23+
-keepclassmembers class com.facebook.react.devsupport.** { *; }
24+
-keep interface com.facebook.react.devsupport.** { *; }
25+
26+
# Keep React Native bridge classes
27+
-keep class com.facebook.react.bridge.** { *; }
28+
-keepclassmembers class com.facebook.react.bridge.** { *; }
29+
30+
# Keep React Native modules and their native methods
31+
-keepclasseswithmembernames class * {
32+
native <methods>;
33+
}
34+
35+
# Keep React Native Turbo Modules
36+
-keep class com.facebook.react.turbomodule.** { *; }
37+
-keep interface com.facebook.react.turbomodule.** { *; }
38+
39+
# Keep Hermes engine classes
40+
-keep class com.facebook.hermes.** { *; }
41+
-keep class com.facebook.jni.** { *; }
42+
43+
# ========================================
44+
# KOTLIN SPECIFIC RULES
45+
# ========================================
46+
47+
# Keep all Kotlin metadata to prevent reflection issues
48+
-keep class kotlin.Metadata { *; }
49+
-keep class kotlin.** { *; }
50+
-keepclassmembers class kotlin.** { *; }
51+
52+
# Keep Kotlin coroutines completely
53+
-keep class kotlinx.coroutines.** { *; }
54+
-keepnames class kotlinx.coroutines.** { *; }
55+
-keepclassmembers class kotlinx.coroutines.** { *; }
56+
-dontwarn kotlinx.coroutines.**
57+
58+
# Keep all companion objects and singletons
59+
-keepnames class * {
60+
public static ** Companion;
61+
public static ** INSTANCE;
62+
}
63+
64+
# Keep Kotlin data classes and their properties
65+
-keepclassmembers class * {
66+
@kotlin.jvm.JvmField <fields>;
67+
public ** component*();
68+
public ** copy(...);
69+
public ** copy$default(...);
70+
}
71+
72+
# ========================================
73+
# SERIALIZATION AND JSON
74+
# ========================================
75+
76+
# Keep Gson classes
77+
-keep class com.google.gson.** { *; }
78+
-keep class * extends com.google.gson.TypeAdapter { *; }
79+
-keep class * implements com.google.gson.TypeAdapterFactory { *; }
80+
-keep class * implements com.google.gson.JsonSerializer { *; }
81+
-keep class * implements com.google.gson.JsonDeserializer { *; }
82+
83+
# Keep serialization annotations
84+
-keepclassmembers class * {
85+
@com.google.gson.annotations.SerializedName <fields>;
86+
@com.google.gson.annotations.Expose <fields>;
87+
}
88+
89+
# ========================================
90+
# NETWORK LIBRARIES
91+
# ========================================
92+
93+
# Keep OkHttp3 classes completely
94+
-dontwarn okhttp3.**
95+
-dontwarn okio.**
96+
-keep class okhttp3.** { *; }
97+
-keep interface okhttp3.** { *; }
98+
-keepnames class okhttp3.** { *; }
99+
100+
# Keep old OkHttp classes (com.squareup.okhttp) - used by some dependencies
101+
-dontwarn com.squareup.okhttp.**
102+
-keep class com.squareup.okhttp.** { *; }
103+
-keep interface com.squareup.okhttp.** { *; }
104+
105+
# Keep Retrofit classes completely
106+
-dontwarn retrofit2.**
107+
-keep class retrofit2.** { *; }
108+
-keepnames class retrofit2.** { *; }
109+
110+
# ========================================
111+
# ANDROID FRAMEWORK CLASSES
112+
# ========================================
113+
114+
# Keep WebView related classes
115+
-keep class android.webkit.** { *; }
116+
-keep class * extends android.webkit.WebViewClient { *; }
117+
-keep class * extends android.webkit.WebChromeClient { *; }
118+
119+
# Keep custom view classes with all constructors
120+
-keep public class * extends android.view.View {
121+
public <init>(android.content.Context);
122+
public <init>(android.content.Context, android.util.AttributeSet);
123+
public <init>(android.content.Context, android.util.AttributeSet, int);
124+
public <init>(android.content.Context, android.util.AttributeSet, int, int);
125+
public void set*(...);
126+
*** get*();
127+
}
128+
129+
# Keep Parcelable implementations
130+
-keep class * implements android.os.Parcelable {
131+
public static final android.os.Parcelable$Creator *;
132+
}
133+
134+
# Keep enum classes
135+
-keepclassmembers enum * {
136+
public static **[] values();
137+
public static ** valueOf(java.lang.String);
138+
**[] $VALUES;
139+
public *;
140+
}
141+
142+
# Keep native methods
143+
-keepclasseswithmembernames class * {
144+
native <methods>;
145+
}
146+
147+
# ========================================
148+
# ESSENTIAL ATTRIBUTES
149+
# ========================================
150+
151+
# Keep all annotations and signatures for runtime reflection
152+
-keepattributes *Annotation*
153+
-keepattributes Signature
154+
-keepattributes InnerClasses
155+
-keepattributes EnclosingMethod
156+
-keepattributes RuntimeVisibleAnnotations
157+
-keepattributes RuntimeInvisibleAnnotations
158+
-keepattributes RuntimeVisibleParameterAnnotations
159+
-keepattributes RuntimeInvisibleParameterAnnotations
160+
161+
# Keep source file names and line numbers for better crash reports
162+
-keepattributes SourceFile,LineNumberTable
163+
164+
# Keep exceptions for better debugging
165+
-keepattributes Exceptions
166+
167+
# ========================================
168+
# TAP PAYMENT SDK RULES
169+
# ========================================
170+
171+
# Keep ALL Tap Checkout SDK classes - no obfuscation at all
172+
-keep class company.tap.tapcheckout_android.** { *; }
173+
-keep interface company.tap.tapcheckout_android.** { *; }
174+
-keepnames class company.tap.tapcheckout_android.** { *; }
175+
-keepclassmembers class company.tap.tapcheckout_android.** { *; }
176+
177+
# Keep all inner classes, companion objects, and nested classes
178+
-keep class company.tap.tapcheckout_android.**$* { *; }
179+
-keep class company.tap.tapcheckout_android.**$Companion { *; }
180+
181+
# Keep Tap Network Kit classes (fixes ClassCastException)
182+
-keep class company.tap.tapnetworkkit.** { *; }
183+
-keep interface company.tap.tapnetworkkit.** { *; }
184+
-keepnames class company.tap.tapnetworkkit.** { *; }
185+
-keepclassmembers class company.tap.tapnetworkkit.** { *; }
186+
-keep class company.tap.tapnetworkkit.**$* { *; }
187+
188+
# Keep all Tap SDK related packages
189+
-keep class company.tap.** { *; }
190+
-keep interface company.tap.** { *; }
191+
-keepclassmembers class company.tap.** { *; }
192+
193+
# ========================================
194+
# LOTTIE ANIMATION RULES
195+
# ========================================
196+
197+
# Keep all Lottie classes (fixes ClassCastException in LottieCompositionFactory)
198+
-keep class com.airbnb.lottie.** { *; }
199+
-keep interface com.airbnb.lottie.** { *; }
200+
-keepclassmembers class com.airbnb.lottie.** { *; }
201+
-keep class com.airbnb.lottie.**$* { *; }
202+
203+
# Don't warn about Lottie
204+
-dontwarn com.airbnb.lottie.**
205+
206+
# Keep Lottie model classes
207+
-keep class com.airbnb.lottie.model.** { *; }
208+
-keep class com.airbnb.lottie.animation.** { *; }
209+
-keep class com.airbnb.lottie.value.** { *; }
210+
211+
# ========================================
212+
# MISSING CLASSES - IGNORE WARNINGS
213+
# ========================================
214+
215+
# Suppress warnings for kotlinx.parcelize.Parcelize
216+
-dontwarn kotlinx.parcelize.Parcelize
217+
218+
# Java beans classes - ignore warnings (not available on Android)
219+
-dontwarn java.beans.**
220+
221+
# Jackson databind classes - ignore warnings
222+
-dontwarn com.fasterxml.jackson.**
223+
224+
# Other JVM-specific classes not available on Android
225+
-dontwarn java.lang.instrument.**
226+
-dontwarn sun.misc.**
227+
-dontwarn javax.annotation.**
228+
-dontwarn org.conscrypt.**
229+
-dontwarn org.bouncycastle.**
230+
-dontwarn org.openjsse.**

0 commit comments

Comments
 (0)