简体   繁体   English

React Native Universal APK立即崩溃

[英]React Native universal apk crashes immediately

I was trying to generate separate apks per cpu architecture and also an universal apk. 我试图为每个cpu架构生成单独的apk,并且还尝试生成通用apk。 I set enableSeparateBuildPerCPUArchitecture = true and universalApk true . 我将enableSeparateBuildPerCPUArchitecture = trueuniversalApk true I was getting an error, so I also had to remove those lines: 我遇到了错误,因此我还必须删除这些行:

ndk {
    abiFilters "armeabi-v7a", "x86"
}

The generated app-armeabi-v7a-release works fine. 生成的app-armeabi-v7a-release正常工作。 But the universal apk crashes immediately. 但是通用apk立即崩溃。

Here's the error it shows. 这是显示的错误。

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
at com.facebook.soloader.SoLoader.b(Unknown Source)
at com.facebook.soloader.SoLoader.a(Unknown Source)
at com.facebook.soloader.SoLoader.a(Unknown Source)
at com.facebook.soloader.SoLoader.a(Unknown Source)
at com.facebook.react.bridge.ReactBridge.staticInit(Unknown Source)
at com.facebook.react.bridge.NativeMap.<clinit>(Unknown Source)
at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create(Unknown Source)
at com.facebook.react.k$5.run(Unknown Source)
at java.lang.Thread.run(Thread.java:760)

How do I fix this? 我该如何解决? Sounds like some native module is not being included in the universal apk. 听起来好像某些本地模块未包含在通用apk中。 Is this because of the removed abiFilters ? 这是因为删除了abiFilters吗?

In my case, it's been solved by using gradle version specified in react-native documentation. 就我而言,它已通过使用react-native文档中指定的gradle版本解决。

In /android/app/build.gradle it should be: /android/app/build.gradle它应该是:

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

and as soon as I updated to com.android.tools.build:gradle:3.3.1 it started to fail with your error. 当我更新到com.android.tools.build:gradle:3.3.1它开始因您的错误而失败。

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

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