React-Native Android 学习笔记——1,配置环境
一,设备与环境1,一台 mac2,安装软件包管理器 Homebrew(中文)终端里输入 3,安装 wget 或者 curlwget,终端里输入 4,安装 nvm (node版本管理器)如果安装了 wget,终端输入 如果安装了 curl,终端输入 5,Android SDK这个不用多说了,相信大家都会的。顺便把 Android SDK 配置到环境变量。 如果你没有 Android SDK,也可以通过终端输入 二,安装和初始react-native demo终端输入 如果显示 进入到你要创建 demo 的目录,终端输入 终端输入 终端输入 如果界面报错提示如下: Unable to download JS bundle
com.facebook.react.devsupport.DebugServerException: Could not connect to development server.
URL: http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false
Try the following to fix the issue:
? Ensure that the packager server is running
? Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
? If you're on a physical device connected to the same machine,run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
? If your device is on the same Wi-Fi network,set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081
at com.facebook.react.devsupport.DevServerHelper$1.onFailure(DevServerHelper.java:203)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:175)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
一般在终端输入 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |