![](/img/trans.png)
[英]react-native run-android fails: Could not install the app on the device, read the error above for
[英]Could not install the app on the device on react-native run-android
我无法运行任何反应本机项目。 它说已经有一个进程在运行。 端口8081由我的MAC上运行的McAfee防病毒软件占用。 并且我决不能杀死它(即使我不应该杀死它,我试过它,看起来它永远不会死!SUDO毕竟没有力量!)
参考#7308 #9145和stackoverflow ,我试图在端口8082上运行。服务器启动,但是, 运行android仍然无法说没有找到设备。 我有我的设备(启用调试模式的Galaxy S7 Edge)和Genymotion打开。
React Native版本详细信息 -
SATJAGAN-M-T0HZ:react-native-card-modal satjagan$ react-native -v
react-native-cli: 1.0.0
react-native: 0.37.0
Genymotion活跃且可用 -
bozzmob:Twitter bozzmobusr$ adb devices
List of devices attached
192.168.57.101:5555 device
运行应用程序的终端日志 - (有趣的是它说JS服务器无法识别 ,那里有任何问题)?
bozzmob:Twitter bozzmobusr$ react-native start --port 8082
Scanning 712 folders for symlinks in /Users/satjagan/collection/work/github/reactnative/react-native-card-modal/node_modules (15ms)
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8082. │
│ │
│ 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
/Users/satjagan/collection/work/github/reactnative/react-native-card-modal
[Hot Module Replacement] Server listening on /hot
React packager ready.
[11/26/2016, 2:47:25 PM] <START> Initializing Packager
[11/26/2016, 2:47:25 PM] <START> Building in-memory fs for JavaScript
[11/26/2016, 2:47:25 PM] <END> Building in-memory fs for JavaScript (184ms)
[11/26/2016, 2:47:25 PM] <START> Building Haste Map
[11/26/2016, 2:47:25 PM] <END> Building Haste Map (425ms)
[11/26/2016, 2:47:25 PM] <END> Initializing Packager (741ms)
bozzmob:Twitter bozzmobusr$ react-native run-android
**JS server not recognized, continuing with build...**
Running adb -s 192.168.57.101:5555 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...
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.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.
不幸的是卸载迈克菲不是一个选择:(如果我有自由,我会先做它。
React-Native仍在尝试连接8081.
上的打包器。通常你打开开发菜单并指定一个不同的端口,但在你的情况下你甚至无法开始。
否则您似乎无法指定端口。 我想你可能有两种选择:
我有类似的问题。 我无法通过kill命令停止McAfee进程。 这是因为它作为服务运行。 然而,它可以通过lanuchctl
工具停止。 尝试这个:
cd /Library/LaunchDaemons sudo launchctl unload com.mcafee.agent.macmn.plist
它将阻止采用8081端口的迈克菲进程。
我几乎在所有情况下都知道应用程序应该使用您当前的项目设置和代码运行,如果它不起作用,请尝试:
killall -9 node
因为Metro Bundler节点进程可能存在问题。 有时会变得紧张起来。
这就是我所做的,但你可以更具体地看看哪些进程持有端口8081
并杀死它们。 (尝试像sudo lsof -n -i4TCP:8081
这样的sudo lsof -n -i4TCP:8081
(引用: lsof定义 )。如果你在localhost上运行一些node.js API,你应该更加小心杀死所有节点进程,但如果你只是做React Native dev,你可以安全地做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.