您的位置:首页 > Web前端 > React

React-Native踩过的那些坑

2017-07-04 21:06 399 查看
问题1:undefined is not an object (evaluating ‘ReactInternals.ReactCurrentOwner’)

出现这个错误让我搞了半天,刚开始以为是this指针绑定问题,最后发现不是。

解决方案:

先在项目根目录执行

npm install


然后再

npm start


问题2:No dimension set for key window



解决方案:

关闭远程,清空项目,然后重新运行app。Try closing terminal, deleting ios/build and run again. I had the same issue but now its working.

问题3:打包好的ReactNative运行在自己X64CPU的手机上,打开RN页面直接闪退

错误:

java.lang.UnsatisfiedLinkError: dlopen failed: "xxx/libgnustl_shared.so" is 32-bit instead of 64-bit


解决方案:

1、在项目的根目录的 gradle.properties里面添加一行代码

android.useDeprecatedNdk=true.


2、在project的root目录下的build.gradle中添加如下代码。

defaultConfig {
···
ndk{
abiFilters "armeabi-v7a","x86"
}
packagingOptions {
exclude "lib/arm64-v8a/librealm-jni.so"
}
}


问题4:Could not get BatchedBridge, make sure your bundle is packaged correctly

解决方案:

首先确认手机的网和电脑的网在不在同一网段。然后需要查看React Packger是否Loading Js 文件。设置Dev Setting的ip地址以及网段。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: