Android App crashes in release mode with obfuscation enabled in proguard
See original GitHub issueI 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.packgename, 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 proguard-rule.pro file. I want to obfuscate my apk code(I can’t controll 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
Any suggestion on , how can I stop my app from crashing without enabling -dontobfuscate
in proguard-rules file?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7
Top GitHub Comments
Try adding
-keep public class com.horcrux.svg.** {*;}
I just ran into this same issue, and the solution worked for me too. Thanks a million!! 😃