React-native在安卓5.0 以下手機運行

Could not run adb reverse: Command failed:
https://stackoverflow.com/questions/31525431/getting-error-closed-twice-on-adb-reverse/31526946

Method1:update android 5.0
Since adb reverse
is not supported in Android versions lower than 5.0, you need to use an alternative method, for example connecting via Wi-Fi instead. If you are using React Native, Facebook has added official documentation to connect to the development server via Wi-Fi. Quoting the instructions for MacOS, but they also have them for Linux and Windows:
Method 2: Connect via Wi-Fi
You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.
You can find the IP address in System Preferences → Network.
Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You'll see a red screen with an error. This is OK. The following steps will fix that. Open the in-app Developer menu. Go to Dev Settings → Debug server host for device. Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). Go back to the Developer menu and select Reload JS.

Follow these steps carefully.
Note: All commands need to run inside a project only.
Run this command first:
npm react-native start

Open another window in the same project and run:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

This will create index.android.bundle
in the assets folder

Run:
npm react-native run-android

Now you can get apk in the build folder which will work fine.

http://www.cnblogs.com/yangruishan/p/7200070.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末臣淤,一起剝皮案震驚了整個濱河市抄谐,隨后出現(xiàn)的幾起案子塘娶,更是在濱河造成了極大的恐慌记某,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,406評論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件旱捧,死亡現(xiàn)場離奇詭異独郎,居然都是意外死亡,警方通過查閱死者的電腦和手機枚赡,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,732評論 3 393
  • 文/潘曉璐 我一進(jìn)店門氓癌,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人贫橙,你說我怎么就攤上這事贪婉。” “怎么了卢肃?”我有些...
    開封第一講書人閱讀 163,711評論 0 353
  • 文/不壞的土叔 我叫張陵疲迂,是天一觀的道長。 經(jīng)常有香客問我践剂,道長鬼譬,這世上最難降的妖魔是什么娜膘? 我笑而不...
    開封第一講書人閱讀 58,380評論 1 293
  • 正文 為了忘掉前任逊脯,我火速辦了婚禮,結(jié)果婚禮上竣贪,老公的妹妹穿的比我還像新娘军洼。我一直安慰自己,他們只是感情好演怎,可當(dāng)我...
    茶點故事閱讀 67,432評論 6 392
  • 文/花漫 我一把揭開白布匕争。 她就那樣靜靜地躺著,像睡著了一般爷耀。 火紅的嫁衣襯著肌膚如雪甘桑。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,301評論 1 301
  • 那天歹叮,我揣著相機與錄音跑杭,去河邊找鬼。 笑死咆耿,一個胖子當(dāng)著我的面吹牛德谅,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播萨螺,決...
    沈念sama閱讀 40,145評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼窄做,長吁一口氣:“原來是場噩夢啊……” “哼愧驱!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起椭盏,我...
    開封第一講書人閱讀 39,008評論 0 276
  • 序言:老撾萬榮一對情侶失蹤组砚,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后掏颊,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體惫确,經(jīng)...
    沈念sama閱讀 45,443評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,649評論 3 334
  • 正文 我和宋清朗相戀三年蚯舱,在試婚紗的時候發(fā)現(xiàn)自己被綠了改化。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,795評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡枉昏,死狀恐怖陈肛,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情兄裂,我是刑警寧澤句旱,帶...
    沈念sama閱讀 35,501評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站晰奖,受9級特大地震影響谈撒,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜匾南,卻給世界環(huán)境...
    茶點故事閱讀 41,119評論 3 328
  • 文/蒙蒙 一啃匿、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧蛆楞,春花似錦溯乒、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,731評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至臂聋,卻和暖如春光稼,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背孩等。 一陣腳步聲響...
    開封第一講書人閱讀 32,865評論 1 269
  • 我被黑心中介騙來泰國打工艾君, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人瞎访。 一個月前我還...
    沈念sama閱讀 47,899評論 2 370
  • 正文 我出身青樓腻贰,卻偏偏與公主長得像,于是被迫代替她去往敵國和親扒秸。 傳聞我的和親對象是個殘疾皇子播演,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,724評論 2 354

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