已有Android工程集成ReactNative页面遇到的问题

问题1:出现图上错误

配置了服务端(就是Android开发端的电脑)ip,再次Reload JS,仍然出错。

原因是需要配置服务器ip和端口,而不是仅仅是ip。举例10.58.104.195:8081

问题 2:

11-15 18:40:51.676  11190-11226/? E/ReactNativeJS﹕ undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach')

11-15 18:40:51.680  11190-11226/? I/ReactNativeJS﹕ 'Failed to print error: ', 'Requiring module "58", which threw an exception.'

11-15 18:40:51.680  11190-11226/? E/ReactNative﹕ Got JS Exception: TypeError: undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach')

11-15 18:40:51.681  11190-11226/? E/unknown:React﹕ Exception in native call from JS

com.facebook.react.bridge.JSExecutionException: TypeError: undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach') (http://10.58.104.195:8081/index.android.bundle?platform=android&dev=true&hot=false:7116)

at com.facebook.react.bridge.ReactBridge.loadScriptFromFile(Native Method)

at com.facebook.react.bridge.JSBundleLoader$2.loadScript(JSBundleLoader.java:58)

at com.facebook.react.bridge.CatalystInstanceImpl$2.call(CatalystInstanceImpl.java:146)

at com.facebook.react.bridge.CatalystInstanceImpl$2.call(CatalystInstanceImpl.java:137)

at com.facebook.react.bridge.queue.MessageQueueThreadImpl$1.run(MessageQueueThreadImpl.java:73)

at android.os.Handler.handleCallback(Handler.java:739)

at android.os.Handler.dispatchMessage(Handler.java:95)

at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)

at android.os.Looper.loop(Looper.java:135)

at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:184)

at java.lang.Thread.run(Thread.java:818)

11-15 18:40:51.750  11190-11226/? A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbbadbeef in tid 11226 (mqt_js)

原因:

node_modules跟工程在同一级目录,但是maven搜索的路径不是同一级路径。

解决,修改maven路径。

错误的路径



修改后的正确路径


参考资料:

1.http://facebook.github.io/react-native/docs/integration-with-existing-apps.html

2. http://www.jianshu.com/p/d63c9a22973d

3.  http://www.jkeabc.com/345123.html

4. https://github.com/facebook/react-native/issues/10140

5. http://www.cnblogs.com/ciki/p/20160121ReactNative-shou-ci-yun-xing-ti-shiReferen.html

6.https://mp.weixin.qq.com/s?__biz=MzI0MjE3OTYwMg==&mid=2649548380&idx=1&sn=6076ad27987e050a1f4e9debd6294073&chksm=f1180d21c66f8437a0e0f6444c8789b2cb90396ee91c9d127b7ea7fd442d48916278c3427b19&scene=0&key=cde9f53f8128acbdeb7159af5e4c0ce32e33beca4c6f65e95c55c702f2f6cc5184a0e103ae242e3c9f522e94d8c51f0a&ascene=0&uin=MjY2MDQxMTEyMA%3D%3D&devicetype=iMac+MacBookPro11%2C4+OSX+OSX+10.10.5+build(14F27)&version=11020201&pass_ticket=0UYKSm29yZhtFCzIHEYP%2FKICgaGuYVJ%2FbvWg%2FzZP%2FihoasxMKASyXpZvWKTqDFnX

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,707评论 25 709
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,701评论 2 45
  • 1《雨》 空调 嗡嗡做响 冷气袭人 风扇 咯吱咯吱摇头 加快空气流动 室内闷热 室外烧烤 燥热难安 嘎嘣 一声响雷...
    E键倾心阅读 1,833评论 0 2
  • 我懦弱,自卑,不敢去努力 从今天起,不能在放弃自己。 只有我优秀到一切不在乎,方可学会去爱。
    战场边缘的少女阅读 937评论 0 0
  • 三、优化(减少回流、重绘)浏览器本身的优化策略:浏览器会维护1个队列,把所有会引起回流、重绘的操作放入这个队列,等...
    奈何明月照沟渠阅读 3,541评论 0 0