question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android App crashes in release mode with obfuscation enabled in proguard

See original GitHub issue

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.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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

36reactions
chyi13commented, Nov 13, 2017

Try adding -keep public class com.horcrux.svg.** {*;}

1reaction
czanellacommented, Oct 26, 2018

I just ran into this same issue, and the solution worked for me too. Thanks a million!! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes in release mode only, how to configure proguard?
Common problems with that is using third party libs. Check your dependency and exclude those libraries from obfuscation process.
Read more >
Android App crashes in release mode with ... - GitHub
I have written one hybrid app which is using react-native-svg to render svg images in react-native views. Everything works perfectly.
Read more >
Android App suddenly crashes when compiling in Release ...
Hi. My App was working fine when build to release mode, and both when downloading from Google play store or from a Android...
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
Learn how to shrink code in your release build to remove unused code and resources.
Read more >
Android App Crashes in release mode. What are the required ...
Android App Crashes in release mode. What are the required class that needs to be added in proGurad. In Debug mode everything works...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found