简体   繁体   English

添加 realm 以反应原生后 Apk 崩溃

[英]Apk crashes after adding realm to react native

Thanks in advance.提前致谢。

I tried to install Realm 3.3.0 on react native and after generating the build when the app opens it crashes.我尝试在 react native 上安装 Realm 3.3.0 并在应用程序打开时生成构建后崩溃。 I use我用

"react": "16.8.6",
"react-native": "0.60.5"

My gradle are我的 gradle 是

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

I put up the log cat and i am getting the following;我放了日志猫,我得到了以下信息;

beginning of crash
2019-10-24 18:07:16.929 11412-11498/com.xxxxx.xxxxx E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.xxxx.xxxxx, PID: 11412
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: library "libjsc.so" not found
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
at io.realm.react.RealmReactModule.<clinit>(RealmReactModule.java:56)
at io.realm.react.RealmReactPackage.createNativeModules(RealmReactPackage.java:31)
at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:41)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1215)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1185)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1123)
at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:124)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:948)
at java.lang.Thread.run(Thread.java:764)

Is there any work around for this??有什么解决方法吗?

I use realm in my daily work, I have met this issue is because realm doesn't support hermes engine yet, see this issue , you need to change enableHermes to false in file android/app/build.gradle我在日常工作中使用realm,我遇到这个问题是因为realm还不支持hermes引擎,看到这个问题,你需要在文件android/app/build.gradle中将enableHermes更改为false

project.ext.react = [
    entryFile: "index.js",
    enableHermes: false,
]

if you are using 0.60.0 or greater version the step to install realm is如果您使用的是 0.60.0 或更高版本,安装 realm 的步骤是

  1. npm i realm

  2. npx react-native link realm , realm's autolink is not working yet, yes, you need link manually with command npx react-native link realm ,领域的自动链接尚未工作,是的,您需要使用命令手动链接

  3. npx jetify

no need to edit MainAplication.java or other file to link more无需编辑 MainAplication.java 或其他文件来链接更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM