1. Android 报错 react native syntaxError:Attempted to redefine property "alignItem"(line 123847)

解决方法:
1. 浏览器打开这个: http://localhost:8081/index.bundle?platform=android&dev=true&hot=false&minify=false,会得到一堆代码,如下图:

2. 另存为这个网页到android.js文件 打开找到123847行,发现重复定义了,找到对应的源文件里面删掉一个就行了.如下图:

3. 根据renderBottomBar 找到源文件:删掉重复定义的字段即可,如下图:

2. Could not run adb reverse: spawnSync(解决)-2018-03-07
1.问题描述
在ReactNative项目运行到Android模拟器上时执行 react-native run-android
会报出标题的错误.
2解决方法
在环境变量的配置文件里面加上下面两行.
export ANDROID_HOME=~/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
3.具体做法:
1. 打开终端
2. 输入 vim ~/.bash_profile
3. 保存退出
4. 在终端输入 source ~/.bash_profile
至此 : 文件修改完毕
然后,继续在RN项目目录下执行命令.
1. react-native start
2. react-native run-android
3. canOverrideExistingModule=true
这种错误是MainApplication里面重复引入了Module导致的删除多余的就行 .
你要是就是要重复引入,按照错误提示做.


网友评论