我尝试在我的 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 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 模拟器上运行我的应用程序?