Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 (How to fix?) - react-native

Show this error whenever I run react-native run-android
react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1598 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
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 808ms
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
How to fix this?

Can you try to navigate in the android directory and run this command
chmod 755 android/gradlew
and then try to run the npm run-android command.

Related

Could not find bugsnag plugin

I clone my project to windows pc ( until now worked on mac ).
After clone I run npm install.
When I trying to run react-native run-android I get error:
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Here is the full log after react-native run-android command.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1100 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find com.bugsnag:bugsnag-android:5.4.0-react-native.
Searched in the following locations:
- file:/C:/Users/ionia/.m2/repository/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
- file:/C:/Users/ionia/Desktop/iCardApp/node_modules/react-native/android/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
- file:/C:/Users/ionia/Desktop/iCardApp/node_modules/jsc-android/dist/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
- https://dl.google.com/dl/android/maven2/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
- https://jcenter.bintray.com/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
- https://www.jitpack.io/com/bugsnag/bugsnag-android/5.4.0-react-native/bugsnag-android-5.4.0-react-native.pom
Required by:
project :app > project :bugsnag_react-native
> Could not find com.bugsnag:bugsnag-plugin-react-native:5.4.0-react-native.
Searched in the following locations:
- file:/C:/Users/ionia/.m2/repository/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
- file:/C:/Users/ionia/Desktop/iCardApp/node_modules/react-native/android/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
- file:/C:/Users/ionia/Desktop/iCardApp/node_modules/jsc-android/dist/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
- https://dl.google.com/dl/android/maven2/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
- https://jcenter.bintray.com/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
- https://www.jitpack.io/com/bugsnag/bugsnag-plugin-react-native/5.4.0-react-native/bugsnag-plugin-react-native-5.4.0-react-native.pom
Required by:
project :app > project :bugsnag_react-native
* 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 6s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\ionia\Desktop\iCardApp>

How to fix the react-native-cli Failed to install the app error?

When i run the react-native run-android i face this error.
I tried to downgrade my java version to 8 but still not working.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 3s
at makeError (D:\freelance\SuperDaily\node_modules\execa\index.js:174:9)
at D:\freelance\SuperDaily\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runOnAllDevices (D:\freelance\SuperDaily\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\freelance\SuperDaily\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
I too got a similar error with this("node_modules/execa/index.js") file.
I resolved my error using the 2 commands given below
npm uninstall -g react-native-cli
yarn global add #react-native-community/cli
If my solution doesn't work then check some other solutions here
react-native run-android --variant Huaweidebug
Run with above command.
it should fixed but in case error exists then open project in android studio

react-native run-android i have isssu how to solve?

C:\Users\Sumithra K\Desktop\s\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'C:\Users\Sumithra' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
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 16s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
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 16s
at makeError (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
C:\Users\Sumithra K\Desktop\s\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'C:\Users\Sumithra' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
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 2s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
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 2s
at makeError (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
It says there is no emulator running to launch the application.
use adb devices command to see if there is any emulator or mobile devices attached.
Let me know if you still need help.

Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory for React-native

I try to run react-native app on android-emulator on my windows 10.
But i am getting the error "Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory". I could not find the solution.
r
react-native --version
react-native-cli: 2.0.1
react-native: 0.62.0
react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 962 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
* 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 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
* 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 4s
at makeError (D:\React\listapp2\node_modules\execa\index.js:174:9)
at Promise.all.then.arr (D:\React\listapp2\node_modules\execa\index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)

Error when I try to run react-native run-android command

C:\Users\hp\Desktop\Reactprojects\Makerobos>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\hp\Desktop\Reactprojects\Makerobos\android\local.properties'.
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
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\hp\Desktop\Reactprojects\Makerobos\android\local.properties'.
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
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\react-native\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)
Your SDK path is not correct you need to add a correct path in the below file:
sa
project > android > local.properties
Add the path like below example:
sdk.dir = /Users/admin/Library/Android/sdk
After added use the following commands:
1. cd android/
2. ./gradlew clean
3. cd ..
4. Command: react-native bundle --platform android --dev false --entry-file indexcsasa.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
csacs
5. react-native run-android
Sometimes the build fails, but it still runs .Have you tried connecting your app via the WIFI to the remote server? Check the connect via wifi method React connect via Wifi
I guess that will work