【发布时间】:2016-11-29 09:08:40
【问题描述】:
我尝试在我的 mac 上的 genymotion android 模拟器上运行 react-native 应用程序。
当我写react-native run-android时,它得到了
Running /usr/local/opt/android-sdk/platform-tools/adb reverse tcp:8081 tcp:8081
error: closed
Could not run adb reverse: Command failed: /usr/local/opt/android-sdk/platform-tools/adb 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:
https://facebook.github.io/react-native/docs/android-setup.html
MacBook-Pro-MacBook:ART-CarefulPeople macbook$
那我试过了:
react-native startreact-native run-android
同样的结果。
那我试过了:
react-native bundle --entry-file index.android.js --platform android --bundle-output android/app/src/main/assets/index.android.bundlecurl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"react-native run-android
同样的结果。
我只试过adb reverse tcp:8081 tcp:8081,上面写着error: closed
当我尝试在 android-sdk 模拟器上运行应用程序时,它会出现上述相同的错误,但没有 error: closed。
我可以从 android studio 运行这个应用程序,它可以在 genymotion 上运行。 请告诉我,我应该怎么做才能在 android 模拟器上运行我的应用程序?
【问题讨论】:
-
adb revese仅适用于 Android 5.0+ 设备 -
是的。我不知道那是什么。我刚刚重新创建了项目,一切正常。
-
我相信,如果您的 Android 手机(假设您有一部)已连接到您的计算机,它可能会尝试在该设备上安装它。如果它已插入,我建议拔掉它,确保您的模拟器正在运行,然后再次尝试
react-native run-android命令。
标签: android-emulator react-native adb genymotion react-native-android