无法在cmd中创建类型为scriptpluginfactory的服务

时间:2019-02-27 06:47:49

标签: android react-native gradle cmd android-gradle

我在Windows的cmd中运行react-native run-android以启动android项目。每次显示此错误。我安装android-stadio和react-native。然后尝试几次

C:\Users\saeedeh>cd desktop

C:\Users\saeedeh\Desktop>cd react native

C:\Users\saeedeh\Desktop\React native>cd app1

C:\Users\saeedeh\Desktop\React native\app1>react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...

FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.cr
eateScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildS
copeServices.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 5s
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.bat installDebug

Error: Command failed: gradlew.bat installDebug
    at checkExecSyncError (child_process.js:616:11)
    at Object.execFileSync (child_process.js:634:13)
    at runOnAllDevices (C:\Users\saeedeh\Desktop\React native\app1\node_modules\
react-native\local-cli\runAndroid\runAndroid.js:299:19)
    at buildAndRun (C:\Users\saeedeh\Desktop\React native\app1\node_modules\reac
t-native\local-cli\runAndroid\runAndroid.js:135:12)
    at isPackagerRunning.then.result (C:\Users\saeedeh\Desktop\React native\app1
\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

1 个答案:

答案 0 :(得分:0)

对我来说,问题是使用JDK 12版,降级到8.0版解决了我的问题。