将react-native与现有应用程序集成,然后找不到libjsc.so

时间:2017-03-05 11:17:09

标签: android react-native

将react-native与现有应用程序集成:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "cn.titaandroid.im"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2017021610
        versionName '0.9.0'

        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        config {
            storeFile file('titaandroid.keystory')
            storePassword '123456'
            keyAlias 'tita'
            keyPassword '123456'
        }
    }
    sourceSets {
        main {
            jni.srcDirs = []
            jniLibs.srcDirs = ['libs']
        }
    }
    packagingOptions {
        exclude 'AndroidManifest.xml'
    }
    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.config //for release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            signingConfig signingConfigs.config //for release
        }
    }
    lintOptions {
        checkReleaseBuilds false

        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    productFlavors {
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile 'com.android.support:support-v4:21.0.3'
        compile project(':Recognizer')
        compile project(':contactcard')
        compile project(':sticker')
        compile 'com.android.support:multidex:1.0.1'
        compile 'com.facebook.stetho:stetho:1.4.2'
        compile files('libs/MiPush_SDK_Client_3_1_2.jar')
        compile project(':IMKit')
        compile project(':CallKit')
        compile project(':RedPacket')
        compile 'com.facebook.react:react-native:+@aar'
    }
    apply plugin: 'com.google.gms.google-services'
}

然后运行它:

03-05 19:07:11.922 31597-31597/cn.titaandroid.im E/Parcel: Reading a NULL string not supported here.
03-05 19:07:26.802 31597-31597/cn.titaandroid.im E/dalvikvm: Could not find class 'com.google.android.gms.gcm.GcmReceiver', referenced from method io.rong.push.RongPushClient.checkReceivers
03-05 19:07:34.042 31597-32748/cn.titaandroid.im E/dalvikvm: dlopen("/data/app-lib/cn.titaandroid.im-2/libreactnativejni.so") failed: dlopen failed: could not load library "libjsc.so" needed by "libreactnativejni.so"; caused by library "libjsc.so" not found
03-05 19:07:34.182 31597-31597/cn.titaandroid.im E/RongLog: [ RongExceptionHandler ] uncaughtException
                                                            java.lang.NoClassDefFoundError: com.facebook.common.logging.FLog
                                                                at com.facebook.react.ReactRootView$KeyboardListener.onGlobalLayout(ReactRootView.java:405)
                                                                at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:808)
                                                                at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1773)
                                                                at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1009)
                                                                at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5544)
                                                                at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
                                                                at android.view.Choreographer.doCallbacks(Choreographer.java:562)
                                                                at android.view.Choreographer.doFrame(Choreographer.java:532)
                                                                at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
                                                                at android.os.Handler.handleCallback(Handler.java:730)
                                                                at android.os.Handler.dispatchMessage(Handler.java:92)
                                                                at android.os.Looper.loop(Looper.java:137)
                                                                at android.app.ActivityThread.main(ActivityThread.java:5166)
                                                                at java.lang.reflect.Method.invokeNative(Native Method)
                                                                at java.lang.reflect.Method.invoke(Method.java:525)
                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:768)
                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
                                                                at dalvik.system.NativeStart.main(Native Method)
03-05 19:07:34.182 31597-32748/? E/RongLog: [ RongExceptionHandler ] uncaughtException
                                            java.lang.RuntimeException: An error occured while executing doInBackground()
                                                at android.os.AsyncTask$3.done(AsyncTask.java:299)
                                                at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
                                                at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
                                                at java.util.concurrent.FutureTask.run(FutureTask.java:239)
                                                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
                                                at java.lang.Thread.run(Thread.java:841)
                                             Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libjsc.so" needed by "libreactnativejni.so"; caused by library "libjsc.so" not found
                                                at java.lang.Runtime.load(Runtime.java:330)
                                                at java.lang.System.load(System.java:511)
                                                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:287)
                                                at java.util.concurrent.FutureTask.run(FutureTask.java:234)
                                                at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 
                                                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
                                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
                                                at java.lang.Thread.run(Thread.java:841) 

我读到了它,但它没有帮助。而这些内容是一年多以前,应该改变: https://github.com/facebook/react-native/issues/4172 https://github.com/facebook/react-native/issues/2814

1 个答案:

答案 0 :(得分:0)

添加

implementation 'org.webkit:android-jsc:r174650'

依赖项