着急!!关于引用第三方jar包,调用so的问题。



  • 各位好,刚接触react-native,遇到一个第三方jar调用失败,怀疑是.so文件的问题

    0_1534211012549_Snip20180814_1.png
    如图这是一个调用pad的扫码功能,安卓原生已经集成,使用react native打包运行发生如上问题,提示找不到jar,下面是生成的apk文件
    0_1534211116340_Snip20180814_2.png
    文件中明明包含对应的Jar啊,查看了jar包源码在EmGpio引用了so如下
    0_1534211200938_Snip20180814_3.png
    我怀疑是不是打包时候so的设置问题,下图是最终apk的lib目录结构0_1534211327279_Snip20180814_4.png
    请问这样打包有什么问题吗,在工程里面,Lib的目录如下
    0_1534211455095_Snip20180814_7.png
    我的gradle设置如下
    0_1534211531026_Snip20180814_9.png

    请教各位这大概是什么问题,非常感谢!

    厂家demo是用原生调用,补充下他的build文件
    0_1534213509487_Snip20180814_11.png

    下面是集成到rn时抛出的异常
    I/System.out: close [socket][/0.0.0.0:57991]
    D/jdwp: processIncoming
    D/jdwp: handlePacket : cmd=0x3, cmdSet=0xB, len=0x13, id=0x14D4, flags=0x0, dataLen=0x8
    D/jdwp: sendRequest : Len=0x4C
    D/dalvikvm: No JNI_OnLoad found in /system/lib/libhjh-gpio.so 0x410deb70, skipping init
    W/dalvikvm: No implementation found for native Lcom/smartdevicesdk/io/EmGpio;.gpioInit:()Z
    D/jdwp: sendRequest : Len=0x59
    E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Could not invoke PadScan.init
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:800)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
    at android.os.Looper.loop(Looper.java:194)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
    at java.lang.Thread.run(Thread.java:838)
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160) 
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:800) 
    at android.os.Handler.dispatchMessage(Handler.java:100) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) 
    at android.os.Looper.loop(Looper.java:194) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192) 
    at java.lang.Thread.run(Thread.java:838) 
    Caused by: java.lang.UnsatisfiedLinkError: Native method not found: com.smartdevicesdk.io.EmGpio.gpioInit:()Z
    at com.smartdevicesdk.io.EmGpio.gpioInit(Native Method)
    at com.smartdevicesdk.scanner.ScanGpio.openPower(ScanGpio.java:13)
    at com.smartdevicesdk.scanner.BaseScannerHelper.<init>(BaseScannerHelper.java:51)
    at com.smartdevicesdk.scanner.ScannerHelper3501.<init>(ScannerHelper3501.java:26)
    at com.dmspda.PadScan.init(PadScan.java:78)
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:525) 
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) 
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160) 
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
    at android.os.Handler.handleCallback(Handler.java:800) 
    at android.os.Handler.dispatchMessage(Handler.java:100) 
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) 
    at android.os.Looper.loop(Looper.java:194) 
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192) 
    at java.lang.Thread.run(Thread.java:838) 
    D/jdwp: sendRequest : Len=0x5E
    D/jdwp: sendRequest : Len=0x63
    D/jdwp: sendRequest : Len=0x6D
    D/jdwp: sendRequest : Len=0x6D
    D/jdwp: sendRequest : Len=0x65
    D/jdwp: sendRequest : Len=0x5A
    D/jdwp: sendRequest : Len=0x73
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x60
    D/AbsListView: checkAbsListViewlLogProperty get invalid command
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x67
    D/jdwp: sendRequest : Len=0x77
    D/ReactNative: CatalystInstanceImpl.destroy() start
    D/jdwp: sendRequest : Len=0x60
    V/InputMethodManager: onWindowFocus: android.widget.ListView{411d7f60 VFED.VC. .F....ID 0,0-320,399 #7f070063 app:id/rn_redbox_stack} softInputMode=272 first=true flags=#1810100
    V/InputMethodManager: START INPUT: android.widget.ListView{411d7f60 VFED.VC. .F....ID 0,0-320,399 #7f070063 app:id/rn_redbox_stack} ic=null tba=android.view.inputmethod.EditorInfo@41267ed0 controlFlags=#105
    V/InputMethodManager: Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@4115acc0 com.android.inputmethod.latin/.LatinIME #790}
    I/SurfaceTextureClient: [STC::queueBuffer] (this:0x522386c8) fps:0.17, dur:5827.01, max:5827.01, min:5827.01
    [STC::queueBuffer] this:0x522386c8, api:1, last queue time elapsed:5827.01
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([375,"topLayout",{"target":375,"layout":{"height":0,"width":300,"y":0,"x":0}}])
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([377,"topLayout",{"target":377,"layout":{"height":0,"width":300,"y":0,"x":0}}])
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([383,"topLayout",{"target":383,"layout":{"height":206,"width":300,"y":193,"x":5}}])
    D/jdwp: sendRequest : Len=0x1D
    D/jdwp: sendRequest : Len=0x65
    D/jdwp: sendRequest : Len=0x62
    I/System.out: [CDS]rx timeout:0
    I/System.out: [socket][27] connection /192.168.1.102:8097;LocalPort=46476(10000)
    I/System.out: [CDS]connect[/192.168.1.102:8097] tm:10
    D/Posix: [Posix_connect Debug]Process com.dmspda :8097
    D/jdwp: sendRequest : Len=0x1D
    W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
    D/jdwp: sendRequest : Len=0x1D
    D/ReactNative: CatalystInstanceImpl.destroy() end
    D/jdwp: sendRequest : Len=0x57
    sendRequest : Len=0x62
    D/jdwp: sendRequest : Len=0x62
    D/jdwp: sendRequest : Len=0x62
    I/System.out: [socket][28:46476] exception
    I/System.out: [CDS]close[46476]
    I/System.out: close [socket][/0.0.0.0:46476]
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["websocketFailed",{"message":"Failed to connect to /192.168.1.102:8097","id":9}])
    D/jdwp: sendRequest : Len=0x1D
    D/jdwp: sendRequest : Len=0x78
    D/jdwp: sendRequest : Len=0x4B
    sendRequest : Len=0x57
    D/jdwp: sendRequest : Len=0x5C
    D/jdwp: sendRequest : Len=0x65
    sendRequest : Len=0x6A
    sendRequest : Len=0x70
    D/jdwp: sendRequest : Len=0x59
    sendRequest : Len=0x5C
    sendRequest : Len=0x6D
    D/jdwp: sendRequest : Len=0x72
    sendRequest : Len=0x6D
    sendRequest : Len=0x72
    D/jdwp: sendRequest : Len=0x5E
    D/jdwp: sendRequest : Len=0x5B
    D/jdwp: sendRequest : Len=0x5C
    sendRequest : Len=0x5E
    sendRequest : Len=0x7C
    D/jdwp: sendRequest : Len=0x78
    D/jdwp: sendRequest : Len=0x58
    sendRequest : Len=0x60
    D/jdwp: sendRequest : Len=0x6D
    D/jdwp: sendRequest : Len=0x65
    sendRequest : Len=0x6A
    D/jdwp: sendRequest : Len=0x70
    sendRequest : Len=0x51
    D/jdwp: sendRequest : Len=0x6A
    sendRequest : Len=0x7B
    D/jdwp: sendRequest : Len=0x80
    sendRequest : Len=0x82
    D/jdwp: sendRequest : Len=0x68
    D/jdwp: sendRequest : Len=0x89
    D/jdwp: sendRequest : Len=0x82
    D/jdwp: sendRequest : Len=0x1D
    D/skia: jpeg_decoder mode 0, config 6, w 24, h 24, sample 1, bsLength 21f!!
    jpeg_decoder mode 1, config 6, w 24, h 24, sample 1, bsLength 21f!!
    D/skia: jpeg_decoder finish successfully, L:1403, reuse 0!!!
    D/jdwp: sendRequest : Len=0x57
    W/unknown:ReactNative: Tried to enqueue runnable on already finished thread: 'native_modules... dropping Runnable.
    W/MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260d10} sending message to a Handler on a dead thread
    java.lang.RuntimeException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260d10} sending message to a Handler on a dead thread
    at android.os.MessageQueue.enqueueMessage(MessageQueue.java:297)
    at android.os.Handler.enqueueMessage(Handler.java:693)
    at android.os.Handler.sendMessageAtTime(Handler.java:595)
    at android.os.Handler.sendMessageDelayed(Handler.java:566)
    at android.os.Handler.post(Handler.java:331)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:59)
    at com.facebook.react.bridge.ReactContext.runOnNativeModulesQueueThread(ReactContext.java:285)
    at com.facebook.react.uimanager.UIManagerModule.setViewLocalData(UIManagerModule.java:359)
    at com.facebook.react.views.textinput.ReactEditText.setIntrinsicContentSize(ReactEditText.java:481)
    at com.facebook.react.views.textinput.ReactEditText.onContentSizeChange(ReactEditText.java:474)
    at com.facebook.react.views.textinput.ReactEditText.access$300(ReactEditText.java:58)
    at com.facebook.react.views.textinput.ReactEditText$TextWatcherDelegator.onTextChanged(ReactEditText.java:682)
    at android.widget.TextView.sendOnTextChanged(TextView.java:7269)
    at android.widget.TextView.handleTextChanged(TextView.java:7328)
    at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8940)
    at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
    at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
    at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
    at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
    at com.facebook.react.views.textinput.ReactEditText.maybeSetText(ReactEditText.java:380)
    at com.facebook.react.views.textinput.ReactTextInputManager.updateExtraData(ReactTextInputManager.java:201)
    at com.facebook.react.views.textinput.ReactTextInputManager.updateExtraData(ReactTextInputManager.java:60)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.updateViewExtraData(NativeViewHierarchyManager.java:150)
    at com.facebook.react.uimanager.UIViewOperationQueue$UpdateViewExtraData.execute(UIViewOperationQueue.java:265)
    at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:894)
    at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1001)
    at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:46)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1061)
    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:774)
    at android.view.Choreographer.doCallbacks(Choreographer.java:579)
    at android.view.Choreographer.doFrame(Choreographer.java:547)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
    at android.os.Handler.handleCallback(Handler.java:800)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5371)
    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:833)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    at dalvik.system.NativeStart.main(Native Method)
    W/unknown:ReactNative: Tried to enqueue runnable on already finished thread: 'native_modules... dropping Runnable.
    W/MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260d10} sending message to a Handler on a dead thread
    java.lang.RuntimeException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260d10} sending message to a Handler on a dead thread
    at android.os.MessageQueue.enqueueMessage(MessageQueue.java:297)
    at android.os.Handler.enqueueMessage(Handler.java:693)
    at android.os.Handler.sendMessageAtTime(Handler.java:595)
    at android.os.Handler.sendMessageDelayed(Handler.java:566)
    at android.os.Handler.post(Handler.java:331)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:59)
    at com.facebook.react.bridge.ReactContext.runOnNativeModulesQueueThread(ReactContext.java:285)
    at com.facebook.react.uimanager.UIManagerModule.setViewLocalData(UIManagerModule.java:359)
    at com.facebook.react.views.textinput.ReactEditText.setIntrinsicContentSize(ReactEditText.java:481)
    at com.facebook.react.views.textinput.ReactEditText.onContentSizeChange(ReactEditText.java:474)
    at com.facebook.react.views.textinput.ReactEditText.onLayout(ReactEditText.java:127)
    at android.view.View.layout(View.java:14118)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.updateLayout(NativeViewHierarchyManager.java:241)
    at com.facebook.react.uimanager.NativeViewHierarchyManager.updateLayout(NativeViewHierarchyManager.java:206)
    at com.facebook.react.uimanager.UIViewOperationQueue$UpdateLayoutOperation.execute(UIViewOperationQueue.java:175)
    at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:894)
    at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1001)
    at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:46)
    at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1061)
    at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:774)
    at android.view.Choreographer.doCallbacks(Choreographer.java:579)
    at android.view.Choreographer.doFrame(Choreographer.java:547)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
    at android.os.Handler.handleCallback(Handler.java:800)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5371)
    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:833)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    at dalvik.system.NativeStart.main(Native Method)
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["onAnimatedValueUpdate",{"value":1,"tag":18}])
    W/unknown:ReactNative: Tried to enqueue runnable on already finished thread: 'js... dropping Runnable.
    W/MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260860} sending message to a Handler on a dead thread
    java.lang.RuntimeException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {41260860} sending message to a Handler on a dead thread
    at android.os.MessageQueue.enqueueMessage(MessageQueue.java:297)
    at android.os.Handler.enqueueMessage(Handler.java:693)
    at android.os.Handler.sendMessageAtTime(Handler.java:595)
    at android.os.Handler.sendMessageDelayed(Handler.java:566)
    at android.os.Handler.post(Handler.java:331)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:59)
    at com.facebook.react.bridge.ReactContext.runOnJSQueueThread(ReactContext.java:297)
    at com.facebook.react.uimanager.events.EventDispatcher$ScheduleDispatchFrameCallback.doFrame(EventDispatcher.java:285)
    at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
    at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:774)
    at android.view.Choreographer.doCallbacks(Choreographer.java:579)
    at android.view.Choreographer.doFrame(Choreographer.java:547)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
    at android.os.Handler.handleCallback(Handler.java:800)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5371)
    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:833)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    at dalvik.system.NativeStart.main(Native Method)
    I/Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread.
    W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["onAnimatedValueUpdate",{"value":2,"tag":18}])
    W/unknown:ReactNative: Invoking JS callback after bridge has been destroyed.
    W/unknown:ReactNative: Invoking JS callback after bridge has been destroyed.
    Invoking JS callback after bridge has been destroyed.
    I/SurfaceTextureClient: [STC::queueBuffer] (this:0x556832d0) fps:1.83, dur:1095.19, max:916.06, min:179.13
    I/System.out: No proyx setting for localhost
    D/libc-netbsd: getaddrinfo: localhost get result from proxy >>
    I/System.out: propertyValue:true
    I/System.out: [CDS]rx timeout:0
    I/System.out: [socket][28] connection localhost/127.0.0.1:8082;LocalPort=57663(10000)


Log in to reply