1.ERROR Packager can't listen on port 8081:这个问题是因为你已经有一个命令行程序正在运行!
2.Could not connect to development server : 打开新的命令行窗口 运行 react-native start
3.* What went wrong:
Execution failedfortask':app:installDebug'.> com.android.builder.testing.api.DeviceException: No connected devices!
*Try:
Runwith--stacktraceoptiontogetthe stack trace. Runwith--infoor--debugoptiontogetmore log output.
BUILD FAILED 这是设备没启动起来 推荐使用genymotion模拟器
4.导入的类必须是大写的 import App from ‘./src/app’;正确 import app from ‘./src/app’;错误.
5.当从github新download下来一个项目,并运行react-native run-ios命令时,报React Native: Command run-ios unrecognized
1.第一步:npm install –save react-native@latest
2.第二步:npm install
6. .invariant violation:expected a component class,got[object object] 创建自定义组件首字母要大写,否则会报错.
7. .Module 0 is not a registered callable module.将gradle升级成最新版本(cdAndroid 进入android目录执行:sudo./gradlew clean) 或者通android studio工具升级.
8..android.view.WindowManager$BadTokenException: Unable to add window – token null is not valid; is your activity running?
该错误属于安卓Native的错误,如果引用的Activity不存在或者已经销毁,再次引用就会报该错误,如果是React Native 调用原生控件的话,创建控件需要引用:getCurrentActivity()
9. .react native undefined is not an object (evaluating this….
发生该错误的一般是忘记bind(this),只要回调函数中需要用到this的,一般都需要bind.
10.react native 错误unable to load script form assets解决
1.首先手动在main下建立一个assets文件夹
2.然后cmd 进入项目的根目录下执行react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
3.在执行react-native run-android 跑起来了