React Native 一:開發(fā)環(huán)境搭建

在學習React Native的過程中瓶殃,相信對于一個App開發(fā)工程師,沒有充分的學習過前端開發(fā)技術(shù)的同學來說娃善,順利的搭建好開發(fā)環(huán)境還是比較糾結(jié)的。

下面瑞佩,我就根據(jù)我自己學習過程中的總結(jié)聚磺,跟大家講解講解如何從零開始順利的搭建React Native的開發(fā)環(huán)境,希望對大家的學習有所幫助炬丸。我是以Ubuntu操作系統(tǒng)進行開發(fā)的瘫寝,具體步驟如下:

1.安裝Git? ??

apt-get?install?git??

2.安裝JDK

? ? a.在官方網(wǎng)站下載相關(guān)的jdk-8u77-linux-x64.tar.gz包;

? ? b.在你的指定目錄下解壓稠炬;

tar?zxvf?jdk-8u77-linux-x64.tar.gz??

? ? c.JAVA_HOME環(huán)境變量的配置焕阿;

? ? ? ? 編輯profile文件:

gedit?/etc/profile??

? ? ? ? 在文件尾部添加:

export?JAVA_HOME=/usr/local/opt/jdk1.8.0_77??

export?CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH???

export?PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH??

? ? ? ? 使用配置生效:

[plain]?view plain?copy

source?/etc/profile??

? ? d.檢驗安裝是否成功:java -version;

3.安裝Android Studio和Android SDK

? ? a.將下載的android-studio-ide-141.2456560-linux.zip解壓到指定目錄下(/usr/local/opt)下

unzip?android-studio-ide-141.2456560-linux.zip??

? ? b.將下載的android-sdk_r24.4.1-linux.tgz解壓到指定目錄(/usr/local/opt)下

tar?zxvf?android-sdk_r24.4.1-linux.tgz??

? ? c.啟動android-studio

cd?/usr/local/opt/android-studio/bin??

./studio.sh??

? ? ?d.創(chuàng)建demo應(yīng)用程序并運行酸纲,檢測環(huán)境是否安裝成功捣鲸;

提示1:pengchengxiang@ubuntu:/usr/local/opt/android-studio/bin$ sudo ./studio.sh

? ? ? ? ERROR: Cannot start Android Studio

? ? ? ? No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.

? ? ? ? 處理1:避免使用sudo方式啟動瑟匆;

提示2:在啟動Android Studio的時候闽坡,有報錯:Unable to run mksdcard SDK tool,則處理如下:

? ? ? ? sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

?提示3:如果在啟動模擬器的時候愁溜,有如下報錯疾嗅,則處理如下:

? ? ? ? Starting emulator for AVD 'AVD_for_Galaxy_Nexus_by_Google'

? ? ? ? PANIC: Could not find AVD_for_Galaxy_Nexus_by_Google.ini file in?$ANDROID_AVD_HOME nor in $HOME/.android/avd"!

? ? ? ? 處理3:ln -s /root/.android/avd /home/pengchengxiang/.android/avd

?提示4:在啟動android studio的過程中,如果提示:

? ? ? ? System Health

? ? ? ? IBus prior to 1.5.11 may cause input problem. See IDEA-78860 for details.

? ?處理4:System Settings -> Language Support冕象,改為Keyboard input method?at the bottom of the page from?ibus?to?none.

?提示5:在啟動android studio的過程中代承,設(shè)置sdk路徑的時候,如果提示:

? ? ? ? the path ''/usr/local/opt/android-sdk-linux' is not writeable,please chose a new location

? ? ? ? 處理5:

? ? ? ? chown -R root /usr/local/opt/android-sdk-linux

? ? ? ? chgrp -R root /usr/local/opt/android-sdk-linux??

? ? ? ? chmod -R 777 /usr/local/opt/android-sdk-linux

4.定義ANDROID_HOME環(huán)境變量

? ? a.在/etc/profile添加如下環(huán)境變量:

export?ANDROID_HOME=/usr/local/opt/android-sdk-linux??

export?PATH=$PATH:$ANDROID_HOME/platform-tools??

? ? b.source /etc/profile使得配置生效渐扮;

5.使用gradle deamon

? ??a.在gradle官網(wǎng)下載gradle-2.12-all.zip

? ? b.將其解壓到你安裝目錄下/usr/local/opt论悴;

unzip?gradle-2.12-all.zip??

? ? c.配置GRADLE_HOME環(huán)境變量掖棉,在/etc/profile文件中添加如下配置;

export?GRADLE_HOME=/usr/local/opt/gradle-2.12??

export?PATH=$PATH:$GRADLE_HOME/bin??

? ? d.source /etc/profile使得配置生效膀估;

? ? e.執(zhí)行g(shù)radle -v確定安裝成功幔亥;

? ? f.配置gradle deamon

touch?~/.gradle/gradle.properties?&&?echo?"org.gradle.daemon=true"?>>?~/.gradle/gradle.properties??

6.配置你的SDK

? ??a.打開你的Android SDK Manager,在展示的窗口檢查你是否安裝如下組件:

? ? b.配置ANDROID_HOME環(huán)境變量察纯,在/etc/profile文件中添加如下配置帕棉;

export?ANDROID_HOME=/usr/local/opt/android-sdk-linux??

export?PATH=$PATH:$ANDROID_HOME/platform-tools??

? ? c.source /etc/profile使得配置生效;

7.安裝Genymotion模擬器?

? ??a.在Genymotion官網(wǎng)下載安裝包genymotion-2.6.0-linux_x64.bin饼记;

? ? b.修改安裝包的執(zhí)行權(quán)限香伴,并執(zhí)行安裝指定安裝目錄;

pengchengxiang@ubuntu:~/Desktop$?chmod?+x?genymotion-2.6.0-linux_x64.bin??

pengchengxiang@ubuntu:~/Desktop$?sudo?./genymotion-2.6.0-linux_x64.bin?-d?/usr/local/opt/??

[sudo]?password?for?pengchengxiang:??

Installing?for?all?users.??

Installing?to?folder?[/usr/local/opt/genymotion].?Are?you?sure?[y/n]???y??

?????-?Trying?to?find?VirtualBox?toolset?....................?OK?(Valid?version?of?VirtualBox?found:?4.3.36_Ubuntur105129)??

?????-?Extracting?files?.....................................?OK?(Extract?into:?[/usr/local/opt/genymotion])??

?????-?Installing?launcher?icon?.............................?OK??

Installation?done?successfully.??

You?can?now?use?these?tools?from?[/usr/local/opt/genymotion]:??

?????-?genymotion??

?????-?genymotion-shell??

?????-?gmtool??

? ? c.進入到/usr/local/opt/genymotion目錄具则,啟動模擬器即纲;? ? ? ?

pengchengxiang@ubuntu:/usr/local/opt/genymotion$?./genymotion??

提示1:運行虛擬機的時候,如果彈出對話框報錯如下:

? ? ? ? Unable to start the virtual device.

? ? ? ? VirtualBox cannot start the virtual device.

? ? ? ? To find out the cause of the proble.start the virtual device from VirtualBox.

? ? ? ? 處理1:Configure virtual device->Processor+Base Memory調(diào)整為1+1024乡洼;

? ? 提示2:運行虛擬機的時候崇裁,如果彈出對話框報錯如下:

? ? ? ? Unable to start the virtual device.

? ? ? ? The Virtual device got no Ip address.

? ? ? ? The VirtualBox DHCP servers has not assigned an IP address to the virtual device.

? ? ? ? To find out the cause of the proble.start the virtual device from VirtualBox.

8.安裝NodeJS

sudo?apt-get?install?-y?build-essential??

curl?-sL?https://deb.nodesource.com/setup_4.x?|?sudo?-E?bash?-??

sudo?apt-get?install?-y?nodejs??

9.安裝Watchman

git?clone?https://github.com/facebook/watchman.git??

cd?watchman??

git?checkout?v4.1.0??#?the?latest?stable?release??

./autogen.sh??

./configure?--prefix=/usr/local/opt/watchman??

make??

sudo?make?install??

提示1:如果在安裝過程中,出現(xiàn)如下報錯:

? ? ? ? x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC- ? ?

? ? ? ? I/usr/include/python2.7 -c pywatchman/bser.c -o build/temp.linux-x86_64-2.7/pywatchman/bser.o

? ? ? ? pywatchman/bser.c:31:20: fatal error: Python.h: No such file or directory

? ? ? ? #include

? ? ? ? ? ? ? ? ? ? ? ^

? ? ? ? compilation terminated.

? ? ? ? error: command 'x86_64-linux-gnu-gcc' failed with exit status 1?

? ? ? ? make[1]: *** [py-build] Error 1

? ? ? ? 處理1:sudo apt-get install python-dev

? ??提示2:如果在安裝過程中束昵,出現(xiàn)如下報錯:

? ? ? ? pengchengxiang@ubuntu:~/watchman$ sudo ./autogen.sh

? ? ? ? ./autogen.sh: 9: ./autogen.sh: aclocal: not found

? ? ? ? ./autogen.sh: 10: ./autogen.sh: autoheader: not found

? ? ? ? ./autogen.sh: 11: ./autogen.sh: automake: not found

? ? ? ? ./autogen.sh: 12: ./autogen.sh: autoconf: not found

? ? ? ? 處理2:apt-get install autoconf

10.安裝Flow

pengchengxiang@ubuntu:~$?npm?install?-g?flow-bin??

npm?WARN?deprecated?graceful-fs@3.0.8:?graceful-fs?version?3?and?before?will?fail?on?newer?node?releases.?Please?update?to?graceful-fs@^4.0.0?as?soon?as?possible.??

>?spawn-sync@1.0.15?postinstall?/usr/lib/node_modules/flow-bin/node_modules/bin-wrapper/node_modules/bin-check/node_modules/spawn-sync??

>?node?postinstall??

npm?WARN?deprecated?lodash@1.0.2:?lodash@<3.0.0?is?no?longer?maintained.?Upgrade?to?lodash@^4.0.0.??

npm?WARN?deprecated?graceful-fs@1.2.3:?graceful-fs?version?3?and?before?will?fail?on?newer?node?releases.?Please?update?to?graceful-fs@^4.0.0?as?soon?as?possible.??

/usr/bin/flow?->?/usr/lib/node_modules/flow-bin/cli.js??

>?flow-bin@0.22.1?postinstall?/usr/lib/node_modules/flow-bin??

>?node?lib/install.js??

fetch?:?https://github.com/facebook/flow/releases/download/v0.22.1/flow-linux64-v0.22.1.zip??

progress?:?[====================]?100%?0.0s??

??flow?binary?test?passed?successfully??

flow-bin@0.22.1?/usr/lib/node_modules/flow-bin??

├──?logalot@2.1.0?(figures@1.5.0,?squeak@1.3.0)??

└──?bin-wrapper@2.1.3?(os-filter-obj@1.0.3,?is-path-global@1.0.2,?npm-installed@1.0.0,?globby@1.2.0,?lnfs@1.1.0,????????download-status@2.2.1,?bin-version-check@2.1.0,?bin-check@1.1.0,?download@3.3.0)??

11.安裝React-Native

pengchengxiang@ubuntu:~$?npm?install?-g?react-native-cli??

/usr/bin/react-native?->?/usr/lib/node_modules/react-native-cli/index.js??

react-native-cli@0.2.0?/usr/lib/node_modules/react-native-cli??

├──?semver@5.1.0??

├──?minimist@1.2.0??

├──?chalk@1.1.3?(escape-string-regexp@1.0.5,?ansi-styles@2.2.1,?supports-color@2.0.0,?strip-ansi@3.0.1,?has-ansi@2.0.0)??

└──?prompt@0.2.14?(revalidator@0.1.8,?pkginfo@0.4.0,?read@1.0.7,?utile@0.2.1,?winston@0.8.3)??

12.創(chuàng)建React-Native項目

pengchengxiang@ubuntu:~$?react-native?init?AwesomeProject??

This?will?walk?you?through?creating?a?new?React?Native?project?in?/home/pengchengxiang/AwesomeProject??

Installing?react-native?package?from?npm...??

Setting?up?new?React?Native?app?in?/home/pengchengxiang/AwesomeProject??

react@0.14.8?node_modules/react??

├──?envify@3.4.0?(through@2.3.8,?jstransform@10.1.0)??

└──?fbjs@0.6.1?(whatwg-fetch@0.9.0,?ua-parser-js@0.7.10,?loose-envify@1.1.0,?promise@7.1.1,?core-js@1.2.6)??

To?run?your?app?on?iOS:??

????cd?/home/pengchengxiang/AwesomeProject??

????react-native?run-ios??

-?or?-??

Open?/home/pengchengxiang/AwesomeProject/ios/AwesomeProject.xcodeproj?in?Xcode??

????Hit?the?Run?button??

To?run?your?app?on?Android:??

????Have?an?Android?emulator?running?(quickest?way?to?get?started),?or?a?device?connected??

????cd?/home/pengchengxiang/AwesomeProject??

????react-native?run-android??

13.在Android設(shè)備上啟動App

? ??a.檢查你的手機是已經(jīng)通過adb連接到PC上:

? ? b.配置Android設(shè)備8081端口拔稳,訪問PC的8081端口的React服務(wù)

pengchengxiang@ubuntu:~/AwesomeProject$?adb?reverse?tcp:8081?tcp:8081??

? ? c.啟動PC端的React服務(wù)

pengchengxiang@ubuntu:~/AwesomeProject$?sudo?react-native?start??

[sudo]?password?for?pengchengxiang:??

┌──────────────────────────────────────────────────────────────┐??

│??Running?packager?on?port?8081.????????????????????????????????????????????????????????????????????????????????????????????│????????????????????????????

│??Keep?this?packager?running?while?developing?on?any?JS?projects.?Feel??????????????????????????????????????????????????????│??

│??free?to?close?this?tab?and?run?your?own?packager?instance?if?you??????????????????????????????????????????????????????????│??

│??prefer.???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????│????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????│??

│??https://github.com/facebook/react-native??????????????????????????????????????????????????????????????????????????????????????????????????????????????│??

│????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????└───────────────────────────────────——————─────────────────────┘??

?Looking?for?JS?files?in??

?????/home/pengchengxiang/AwesomeProject??

?[1:36:30?AM]??Building?Dependency?Graph??

?[1:36:30?AM]??Crawling?File?System??

?[Hot?Module?Replacement]?Server?listening?on?/hot??

?????React?packager?ready??

? ? d.安裝并啟動App? ?

pengchengxiang@ubuntu:~/AwesomeProject$?react-native?run-android??

Starting?JS?server...??

Building?and?installing?the?app?on?the?device?(cd?android?&&?./gradlew?installDebug)...??

WARNING?[Project:?:app]?Current?NDK?support?is?deprecated.??Alternative?will?be?provided?in?the?future.??

:app:preBuild?UP-TO-DATE??

:app:preDebugBuild?UP-TO-DATE??

:app:checkDebugManifest??

:app:preReleaseBuild?UP-TO-DATE??

:app:prepareComAndroidSupportAppcompatV72301Library?UP-TO-DATE??

:app:zipalignDebug?UP-TO-DATE??

:app:assembleDebug?UP-TO-DATE??

:app:installDebug??

Installing?APK?'app-debug.apk'?on?'x600?-?5.0.2'??

Installed?on?1?deviced??

????BUILD?SUCCESSFUL??

????Total?time:?18.708?secs??

????Starting?the?app?(/usr/local/opt/android-sdk-linux/platform-tools/adb?shell?am?start?-n?com.awesomeproject/.MainActivity)...??

????Starting:?Intent?{?cmp=com.awesomeproject/.MainActivity?}??

? ? c.啟動App后,點擊Road JS等待加載锹雏。加載成功后巴比,顯示如下頁面:

提示1:在安裝項目App的時候,如果報錯如下:

? ? ? ? pengchengxiang@ubuntu:~/AwesomeProject$ sudo react-native run-android

? ? ? ? [sudo] password for pengchengxiang:

? ? ? ? Starting JS server...

? ? ? ? Building and installing the app on the device (cd android && ./gradlew installDebug)...

? ? ? ? ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

? ? ? ? Please set the JAVA_HOME variable in your environment to match the

? ? ? ? location of your Java installation.

? ? ? ? Could not install the app on the device, read the error above for details.

? ? ? ? Make sure you have an Android emulator running or a device connected and have

? ? ? ? set up your Android development environment:

? ? ? ? ??https://facebook.github.io/react-native/docs/android-setup.html

? ? ? ? 處理1:不使用sudo安裝項目app礁遵,執(zhí)行?react-native run-android?? ? ? ? ?

? ? 提示2:在運行項目的時候轻绞,如果報錯如下:

? ? ? ? pengchengxiang@ubuntu:~/AwesomeProject$ react-native run-android

? ? ? ? fs.js:549

? ? ? ? ? ?return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);

? ? ? ? ? ? ? ? ? ? ? ?^

? ? ? ? ? ? ? ? Error: EACCES: permission denied, open '/home/pengchengxiang/.babel.json'

? ? ? ? at Error (native)

? ? ? ?at Object.fs.openSync (fs.js:549:18)

? ? ? ?at Object.fs.writeFileSync (fs.js:1156:15)

? ? ? ?at save (/home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/babel-register/lib/cache.js:48:19)

? ? ? ?at nextTickCallbackWith0Args (node.js:420:9)

? ? ? ?at process._tickCallback (node.js:349:13)

? ? ? ?at Function.Module.runMain (module.js:443:11)

? ? ? ?at startup (node.js:139:18)

? ? ? ?at node.js:968:3

? ? 處理2:改變.babel.json文件的訪問權(quán)限

pengchengxiang@ubuntu:~$ ls -al | grep .babel.json?? ? ?

? ??-rw-r--r--? ?1 root? ? ? ? ? ?root? ? ? ? ? ?715363 Apr? 2 00:58 .babel.json

? ? pengchengxiang@ubuntu:~$ sudo chown pengchengxiang ~/.babel.json

? ? pengchengxiang@ubuntu:~$ ls -al | grep .babel.json

? ? -rw-r--r--? ?1 pengchengxiang root? ? ? ? ? ?715363 Apr? 2 00:58 .babel.json

? ??提示3:遇見如下報錯

? ? ? ? FAILURE: Build failed with an exception.

? ? ? ? ? ? * What went wrong:

? ? ? ? ? ? A problem occurred configuring project ':app'.

? ? ? ? ? ? > failed to find Build Tools revision 23.0.1

? ? ? ? 處理3,打開Android SDK佣耐,安裝Build Tools revision 23.0.1

? ??提示4:遇見如下報錯

? ? ? ? FAILURE: Build failed with an exception.

? ? ? ? * What went wrong:

? ? ? ? Could not create service of type TaskArtifactStateCacheAccess using TaskExecutionServices.createCacheAccess().

? ? ? ? > Failed to create parent directory '/home/pengchengxiang/AwesomeProject/android/.gradle' when creating directory '/home/pengchengxiang/AwesomeProject/android/.gradle/2.4/taskArtifacts'

? ??處理4:不使用sudo?react-native init AwesomeProject 創(chuàng)建項目直接?react-native init AwesomeProject

?提示5:遇見如下報錯

? ? ? ? FAILURE: Build failed with an exception.

? ? ? ? * What went wrong:

? ? ? ? Execution failed for task ':app:installDebug'.

? ? ? ? > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APK

? ? ? ? 處理5:把項目中的~/android/app/build.gradle中的gradle版本改為1.2.3

? ??提示6:在啟動react服務(wù)的時候政勃,運行幾秒后報錯如下:

? ? ? ? pengchengxiang@ubuntu:~/AwesomeProject$ react-native start

? ? ? ? ┌────────────────────────────────────────────────────────────────────────────┐

? ? ? ? │? Running packager on port 8081. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?│

? ? ? ? │ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?│

? ? ? ? │? Keep this packager running while developing on any JS projects. Feel ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │ ?

? ? ? ? │? free to close this tab and run your own packager instance if you ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │

? ? ? ? │? prefer. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │

? ? ? ? │ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │

│?https://github.com/facebook/react-native? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │

? ? ? ? │ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? │

? ? ? ? └────────────────────────────────────────────────────────────────────────────┘

? ? ? ? Looking for JS files in

? ? ? ? /home/pengchengxiang/AwesomeProject

? ? ? ? [6:38:04 AM] Building Dependency Graph

? ? ? ? [6:38:04 AM] Crawling File System

? ? ? ? [Hot Module Replacement] Server listening on /hot

? ? ? ? React packager ready.

? ? ? ? ERROR? watch /home/pengchengxiang/AwesomeProject/android/app/build/intermediates/res/debug/values-el ENOSPC

? ? ? ? {"code":"ENOSPC","errno":"ENOSPC","syscall":"watch /home/pengchengxiang/AwesomeProject/android/app/build/intermediates/res/debug/values- ? ? ?????el","filename":"/home/pengchengxiang/AwesomeProject/android/app/build/intermediates/res/debug/values-el"}

? ? ? ? Error: watch /home/pengchengxiang/AwesomeProject/android/app/build/intermediates/res/debug/values-el ENOSPC

? ? ? ? ? ?at exports._errnoException (util.js:870:11)

? ? ? ? ? ?at FSWatcher.start (fs.js:1234:19)

? ? ? ? ? ?at Object.fs.watch (fs.js:1262:11)

? ? ? ? ? ?at NodeWatcher.watchdir (/home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/sane/src/node_watcher.js:144:20)

? ? ? ? ? at Walker. (/home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/sane/src/node_watcher.js:353:12)

? ? ? ? ? at emitTwo (events.js:87:13)

? ? ? ? ? at Walker.emit (events.js:172:7)

? ? ? ? ? at /home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/sane/node_modules/walker/lib/walker.js:69:16

? ? ? ? ?at /home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/graceful-fs/graceful-fs.js:142:16

? ? ? ? at /home/pengchengxiang/AwesomeProject/node_modules/react-native/node_modules/graceful-fs/graceful-fs.js:142:16

? ? ? ? See http://facebook.github.io/react-native/docs/troubleshooting.html

? ? ? ? for common problems and solutions.

? ? ? ? 處理6:sudo?react-native start

?提示7:如果App在啟動之后,顯示紅色報錯界面兼砖,報錯如下

? ? ? ? java.util.concurrent.ExecutionException:java.lang.RuntimeException:ReferenceError:Can't find variable:__fbBatchedBride(:1>

或者Couldn‘t?get?the?native?call?queue:bridge?configuration?isn't?available

? ? ? ? 處理7:如果你使用USB在你的設(shè)備上進行調(diào)試奸远,則運行adb reverse tcp:8081 tcp:8081,然后點擊Road JS按鈕讽挟,等待加載懒叛。? ?

提示8:運行adb reverse tcp:8081 tcp:8081出現(xiàn)error closed

? ? ? ? ? ? 測試設(shè)備需要5.0以上才可以支持這個命令

提示9:安裝完成,發(fā)現(xiàn)頁面是空白的耽梅,什么都沒有薛窥?

可以從設(shè)置——應(yīng)用中選擇某一個應(yīng)用,然后將懸浮窗打開即可,

設(shè)置——應(yīng)用管理——選擇需要的app——權(quán)限管理——打開懸浮窗

提示10:運行結(jié)束出現(xiàn)如圖1內(nèi)容眼姐,點擊RELOAD JS 出現(xiàn)圖2:如果手機和電腦不在同一個網(wǎng)段诅迷,或者手機不能訪問到佩番,就會出現(xiàn)如下頁面:

處理:(5.0或4.4手機都適用)搖一搖手機,出現(xiàn)如圖3畫面-點擊DevSettings->?Debugserver hostfordevice罢杉,填入你開發(fā)電腦的 IP 地址答捕。ipconfig查看電腦的ip

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市屑那,隨后出現(xiàn)的幾起案子拱镐,更是在濱河造成了極大的恐慌,老刑警劉巖持际,帶你破解...
    沈念sama閱讀 207,113評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件沃琅,死亡現(xiàn)場離奇詭異,居然都是意外死亡蜘欲,警方通過查閱死者的電腦和手機益眉,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,644評論 2 381
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來姥份,“玉大人郭脂,你說我怎么就攤上這事〕呵福” “怎么了展鸡?”我有些...
    開封第一講書人閱讀 153,340評論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長埃难。 經(jīng)常有香客問我莹弊,道長,這世上最難降的妖魔是什么涡尘? 我笑而不...
    開封第一講書人閱讀 55,449評論 1 279
  • 正文 為了忘掉前任忍弛,我火速辦了婚禮,結(jié)果婚禮上考抄,老公的妹妹穿的比我還像新娘细疚。我一直安慰自己,他們只是感情好川梅,可當我...
    茶點故事閱讀 64,445評論 5 374
  • 文/花漫 我一把揭開白布疯兼。 她就那樣靜靜地躺著,像睡著了一般挑势。 火紅的嫁衣襯著肌膚如雪镇防。 梳的紋絲不亂的頭發(fā)上啦鸣,一...
    開封第一講書人閱讀 49,166評論 1 284
  • 那天潮饱,我揣著相機與錄音,去河邊找鬼诫给。 笑死香拉,一個胖子當著我的面吹牛啦扬,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播凫碌,決...
    沈念sama閱讀 38,442評論 3 401
  • 文/蒼蘭香墨 我猛地睜開眼扑毡,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了盛险?” 一聲冷哼從身側(cè)響起瞄摊,我...
    開封第一講書人閱讀 37,105評論 0 261
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎苦掘,沒想到半個月后换帜,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,601評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡鹤啡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,066評論 2 325
  • 正文 我和宋清朗相戀三年惯驼,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片递瑰。...
    茶點故事閱讀 38,161評論 1 334
  • 序言:一個原本活蹦亂跳的男人離奇死亡祟牲,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出抖部,到底是詐尸還是另有隱情说贝,我是刑警寧澤,帶...
    沈念sama閱讀 33,792評論 4 323
  • 正文 年R本政府宣布慎颗,位于F島的核電站狂丝,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏哗总。R本人自食惡果不足惜几颜,卻給世界環(huán)境...
    茶點故事閱讀 39,351評論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望讯屈。 院中可真熱鬧蛋哭,春花似錦、人聲如沸涮母。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,352評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽叛本。三九已至沪蓬,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間来候,已是汗流浹背跷叉。 一陣腳步聲響...
    開封第一講書人閱讀 31,584評論 1 261
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人云挟。 一個月前我還...
    沈念sama閱讀 45,618評論 2 355
  • 正文 我出身青樓梆砸,卻偏偏與公主長得像,于是被迫代替她去往敵國和親园欣。 傳聞我的和親對象是個殘疾皇子帖世,可洞房花燭夜當晚...
    茶點故事閱讀 42,916評論 2 344

推薦閱讀更多精彩內(nèi)容