Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native error while creating app " Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory()."

Tags:

react-native

I tried to do

react-native run-android

However it comes up with errors

--------------
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:637:11)
        at Object.execFileSync (child_process.js:655:13)
        at runOnAllDevices (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
        at buildAndRun (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
        at isPackagerRunning.then.result (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
        at processTicksAndRejections (internal/process/next_tick.js:81:5)
like image 287
Raden Bagus Avatar asked Jan 29 '19 03:01

Raden Bagus


3 Answers

I had a similar issue here, in my case it was related to access permission. Just give read access to the project folder.

Command:

chmod -R 777 YourFolder/

My log error:

spawnSync ./gradlew EACCES

Error: spawnSync ./gradlew EACCES
    at Object.spawnSync (internal/child_process.js:998:20)
    at spawnSync (child_process.js:622:24)
    at Object.execFileSync (child_process.js:650:13)
    at runOnAllDevices (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

Hope it helps!

like image 182
Willow Chung Avatar answered Nov 14 '22 19:11

Willow Chung


run chmod 755 android/gradlew

that should do the work

like image 5
cmTanko Avatar answered Nov 14 '22 19:11

cmTanko


Check the version of Java JDK you are using. I tried version 11 at first but got the same error you have, then I installed Java JDK version 8 and update the JAVA_HOME setting correctly according this therefor problem solved.

like image 2
Beny Sad Avatar answered Nov 14 '22 19:11

Beny Sad