我尝试在我的mac上运行genymotion android模拟器上的react-native应用程序。 当我写react-native run-android
它得到在Android模拟器上运行react-native
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 start
react-native run-android
相同的结果。
然后我试着:
react-native bundle --entry-file index.android.js --platform android --bundle-output android/app/src/main/assets/index.android.bundle
curl "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+设备 – Xeijp
是的,我不知道是什么我刚刚重新创建项目,一切正常。 – alborozd
我相信如果你的Android手机(假设你有一个)连接到你的电脑,它可能会试图将它安装在该设备上。如果它被插入,我会建议拔掉它,确保你的模拟器正在运行,然后再次尝试'react-native run-android'命令。 – jasonmerino