App crashing with proguard enabled in react-native 0.57.X - couldn't find DSO to load: librealmreact.so
See original GitHub issueGoals
Trying to build a production ready apk (Android).
Actual Results
App crashes if proguard is enabled (def enableProguardInReleaseBuilds = true
).
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:522)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:420)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:370)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:335)
at io.realm.react.RealmReactModule.<clinit>(RealmReactModule.java:59)
It crashes no matter if you split in several apks or only one.
This is my proguard config:
# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate
# React Native
# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
@com.facebook.common.internal.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-dontwarn com.facebook.react.**
# okhttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
Version of Realm and Tooling
- Realm JS SDK Version: 2.12.0
- React Native: 0.56.0
- Client OS & Version: OSX High Sierra
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:29 (7 by maintainers)
Top Results From Across the Web
App crashing with proguard enabled in react-native 0.57.X
App crashing with proguard enabled in react-native 0.57.X - couldn't find DSO to load: librealmreact.so.
Read more >React Native app crashing on Proguard Enable - Stack Overflow
Enabling proguard reduces the app size, In my case disabing Proguard is Ok as app size is very less. However I wanted if...
Read more >Enabling R8 crashes application [167913510] - Issue Tracker
I tried to migrate to Proguard by setting android.enableR8=false to gradle.properties and useProguard true in Gradle file, and the app worked fine without ......
Read more >React Native Final Steps - Red Shift
Consider Enabling ProGuard & Hermes Engine; Quality Assurance Walkthroughs; Check Startup Speed for Performance Issues; Bulletproof Your App; Re ...
Read more >ProGuard configuration | Detox - Open Source
ProGuard configuration · release build type is typically the one to have ProGuard enabled. · ProGuard files present by default in React Native...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I add “-keep class io.realm.react.**” into the file proguard-rules.pro. Now it runs well
react-native : “0.59.3” Adding :
ndk { abiFilters "armeabi-v7a", "x86" }
To build.gradle defaultConfig fixed it for me.