App crash instantly in android
Ajmal0197 opened this issue · comments
Description
Hi, my android app is working fine in dev mode but in release mode its crashing.
Using it like this:
export const getTheme = storage.getString(APP_THEME) || 'light';
UnistylesRegistry.addThemes({
light: lightTheme,
dark: darkTheme,
// premium: premiumTheme,
}).addConfig({
initialTheme: getTheme,
THis is my android log:
A thread.cc:2526] Throwing new exception 'no "I" field "height" in class "Lcom/unistyles/Dimensions;" or its superclasses' with unexpected pending exception: java.lang.NoSuchFieldError: no "I" field "width" in class "Lcom/unistyles/Dimensions;" or its superclasses
thread.cc:2526] at void com.unistyles.UnistylesModule.nativeInstall(long, com.unistyles.Dimensions, java.lang.String, java.lang.String, com.unistyles.Insets, com.unistyles.Dimensions, com.unistyles.Dimensions) (SourceFile:-2)
thread.cc:2526] at boolean com.unistyles.UnistylesModule.install() (SourceFile:-1)
thread.cc:2526] at void com.facebook.jni.NativeRunnable.run() (SourceFile:-2)
thread.cc:2526] at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:1013)
thread.cc:2526] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:101)
thread.cc:2526] at void com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(android.os.Message) (SourceFile:-1)
thread.cc:2526] at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:226)
thread.cc:2526] at void android.os.Looper.loop() (Looper.java:328)
thread.cc:2526] at void com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run() (SourceFile:-1)
thread.cc:2526] at void java.lang.Thread.run() (Thread.java:1012)
thread.cc:2526]
2024-06-01 00:39:42.722 12011-17201 testemployeeapp usap64 A runtime.cc:691] at com.facebook.jni.NativeRunnable.run(Native method)
runtime.cc:691] at android.os.Handler.handleCallback(Handler.java:1013)
runtime.cc:691] at android.os.Handler.dispatchMessage(Handler.java:101)
runtime.cc:691] at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(unavailable:0)
runtime.cc:691] at android.os.Looper.loopOnce(Looper.java:226)
runtime.cc:691] at android.os.Looper.loop(Looper.java:328)
runtime.cc:691] at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(unavailable:51)
runtime.cc:691] at java.lang.Thread.run(Thread.java:1012)
runtime.cc:691] Pending exception java.lang.NoSuchFieldError: no "I" field "width" in class "Lcom/unistyles/Dimensions;" or its superclasses
runtime.cc:691] at void com.unistyles.UnistylesModule.nativeInstall(long, com.unistyles.Dimensions, java.lang.String, java.lang.String, com.unistyles.Insets, com.unistyles.Dimensions, com.unistyles.Dimensions) (SourceFile:-2)
runtime.cc:691] at boolean com.unistyles.UnistylesModule.install() (SourceFile:-1)
runtime.cc:691] at void com.facebook.jni.NativeRunnable.run() (SourceFile:-2)
runtime.cc:691] at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:1013)
runtime.cc:691] at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:101)
runtime.cc:691] at void com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(android.os.Message) (SourceFile:-1)
runtime.cc:691] at boolean android.os.Looper.loopOnce(android.os.Looper, long, int) (Looper.java:226)
runtime.cc:691] at void android.os.Looper.loop() (Looper.java:328)
runtime.cc:691] at void com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run() (SourceFile:-1)
runtime.cc:691] at void java.lang.Thread.run() (Thread.java:1012)
runtime.cc:691] ```
### Steps to reproduce
On making release android build its crashing.
### Snack or a link to a repository (optional)
_No response_
### Unistyles version
2.7.2
### React Native version
0.73.4
### Platforms
Android
### Engine
Hermes
### Architecture
Paper (old)
Hey, it's about the proguard. Please check other issues / documentation.
Fixed by adding rules in proguard-rules.pro
:
-keep class com.unistyles.** { ; } <---
-keep class io.invertase.firebase.* { ; }
-dontwarn io.invertase.firebase.*
-keep class com.swmansion.reanimated.** { ; }
-keep class com.facebook.react.turbomodule.* { ; }
-keep public class com.horcrux.svg.* {*;}
-keep class com.unistyles.** { *; }