1斑举、安裝Android開發(fā)環(huán)境(JDK搅轿、Android Studio)
2、下載并安裝nodejs富玷,下載官網(wǎng):https://nodejs.org/en/
3璧坟、安裝react-native命令,在命令行中執(zhí)行“npm install -g react-native-cli”進(jìn)行安裝赎懦,需要等待一段時間
4雀鹃、執(zhí)行命令下載一個初始化項(xiàng)目(項(xiàng)目在GitHub上):react-native init <項(xiàng)目名稱>
5、運(yùn)行項(xiàng)目并安裝到Android設(shè)備上(命令行):react-native run-android
6铲敛、WebStorm本身支持React-Native褐澎,新建項(xiàng)目后->運(yùn)行->命令行運(yùn)行react-native run-android
7会钝、瀏覽器上調(diào)試
安裝Chrome瀏覽器的插件:React Developer Tools
chrome://inspect/#devices
http://localhost:8081/debugger-ui/ 同時按下F12
晃動手機(jī)伐蒋,選擇 Remote JS Debugging
/////// 報錯處理 ////////////
1工三、運(yùn)行時出現(xiàn)錯誤Unable to load script from assets 'index.android.bundle'...時處理如下(命令行執(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 && react-native run-android