реагировать родной запуск на андроид симуляторе - PullRequest
0 голосов
/ 10 марта 2019

У меня есть macOS, и когда я хочу запустить свой React Native-код на устройстве Android, будет показана эта ошибка:

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
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/getting-started.html

Command failed: ./gradlew installDebug

Error: Command failed: ./gradlew installDebug
    at checkExecSyncError (child_process.js:616:11)
    at Object.execFileSync (child_process.js:634:13)
    at runOnAllDevices (/Users/tanhaeirad/Project/Rahanj/RezasPortal/portalapp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/Users/tanhaeirad/Project/Rahanj/RezasPortal/portalapp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/Users/tanhaeirad/Project/Rahanj/RezasPortal/portalapp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

мой код успешно работает на ios, но когда я хочу запустить на Android, эта ошибка будет отображаться.

я запускаю симулятор android studio и набираю этот код:

react-native run-android
...