将react-native集成到现有App中

时间:2016-12-16 08:55:20

标签: android react-native react-native-android

我们正在尝试将react-native集成到我们现有的Android应用程序中: build.gradle的SDK要求是:

minSdkVersion 16
targetSdkVersion 23

我们使用Intent来调用最初的React index.js:

Intent inte = new Intent(this, ReactNativeStarter.class);
startActivity(inte);

其余代码来自react integration tutorial。

当我们尝试调用反应组件时,我们会收到以下错误:

12-16 09:37:52.041 E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: XXXXX, PID: XXXX
java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:300)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libfbjni.so" needed by "libreactnativejni.so"; caused by cannot locate symbol "_ZSt16__get_once_mutexv" referenced by "libfbjni.so"...
    at java.lang.Runtime.load(Runtime.java:331)
    at java.lang.System.load(System.java:982)
    at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
    at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:209)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
    at com.facebook.react.bridge.JSCJavaScriptExecutor.<clinit>(JSCJavaScriptExecutor.java:25)
    at com.facebook.react.bridge.JSCJavaScriptExecutor$Factory.create(JSCJavaScriptExecutor.java:20)
    at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:183)
    at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
    at java.lang.Thread.run(Thread.java:818) 

你能帮忙吗?

1 个答案:

答案 0 :(得分:0)

通过在build.gradle中更改Exclude to pickFirst

来解决此问题