I have written one hybrid app which is using react-native-svg to render svg images in react-native views. Everything works perfectly. Today, When I created release apk for my app and deployed it to an emulator it crashed with an error:
E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.example.packagname, PID: 8574
java.lang.IllegalStateException: java.lang.NoSuchFieldException: mFill
at com.horcrux.svg.q.a(Unknown Source:78)
at com.horcrux.svg.i$1.a(Unknown Source:9)
at com.horcrux.svg.aa.a(Unknown Source:22)
at com.horcrux.svg.i.b(Unknown Source:14)
at com.horcrux.svg.i.a(Unknown Source:10)
at com.horcrux.svg.t.a(Unknown Source:104)
at com.horcrux.svg.t.c(Unknown Source:25)
at com.horcrux.svg.t.a(Unknown Source:7)
at com.facebook.react.uimanager.u.a(Unknown Source:5)
at com.facebook.react.uimanager.ag.a(Unknown Source:56)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.d(Unknown Source:83)
at com.facebook.react.uimanager.ag.e(Unknown Source:17)
at com.facebook.react.uimanager.UIManagerModule.onBatchComplete(Unknown Source:27)
at com.facebook.react.bridge.z.d(Unknown Source:30)
at com.facebook.react.bridge.CatalystInstanceImpl$a.onBatchComplete(Unknown Source:14)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.a.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(Unknown Source:16)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NoSuchFieldException: mFill
at java.lang.Class.getField(Class.java:1601)
at com.horcrux.svg.q.a(Unknown Source:41)
at com.horcrux.svg.i$1.a(Unknown Source:9)
at com.horcrux.svg.aa.a(Unknown Source:22)
at com.horcrux.svg.i.b(Unknown Source:14)
at com.horcrux.svg.i.a(Unknown Source:10)
at com.horcrux.svg.t.a(Unknown Source:104)
at com.horcrux.svg.t.c(Unknown Source:25)
at com.horcrux.svg.t.a(Unknown Source:7)
at com.facebook.react.uimanager.u.a(Unknown Source:5)
at com.facebook.react.uimanager.ag.a(Unknown Source:56)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.d(Unknown Source:83)
at com.facebook.react.uimanager.ag.e(Unknown Source:17)
at com.facebook.react.uimanager.UIManagerModule.onBatchComplete(Unknown Source:27)
at com.facebook.react.bridge.z.d(Unknown Source:30)
at com.facebook.react.bridge.CatalystInstanceImpl$a.onBatchComplete(Unknown Source:14)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.a.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(Unknown Source:16)
at java.lang.Thread.run(Thread.java:764)
I see this problem only when I comment -dontobfuscate
from the proguard-rule.pro file. I want to obfuscate my apk code(I can't control it.).
I am using proguard file similar to the one shown in this example,
https://github.com/magicismight/react-native-svg-example/blob/cfb788461efae0de367c97aadcc829cdeb959a8d/android/app/proguard-rules.pro
Has anyone else faced this issue? Any suggestion on , how can I stop my app from crashing without enabling -dontobfuscate in proguard-rules file?
Edit I am pretty new to android development and I am trying proguard for the first time. Any positive suggestions on how to debug such issues will be really helpful.