我嘗試在我的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