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]? ? ? ? ? ?創(chuàng)建自定義組件首字母要大寫,否則會報錯.
7.? .Module 0 is not a registered callable module.將gradle升級成最新版本(cdAndroid 進入android目錄執(zhí)行: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 調用原生控件的話,創(chuàng)建控件需要引用:getCurrentActivity()
9.? .react native undefined is not an object (evaluating this….
發(fā)生該錯誤的一般是忘記bind(this),只要回調函數中需要用到this的捺球,一般都需要bind.
10.react native 錯誤unable to load script form assets解決
? ? ? 1.首先手動在main下建立一個assets文件夾
? ? ?2.然后cmd 進入項目的根目錄下執(zhí)行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.在執(zhí)行react-native run-android 跑起來了