Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory for React-native - 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)

Related

Build failed with an exception error in react-native-community/cli

i got error after i install npm i #react-native-community/cli-platform-android and uninstall it
i am using the latest react native 0.7.1
$ npx react-native run-android
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\ASUS\Documents\contra\android\settings.gradle' line: 2
What went wrong:
A problem occurred evaluating settings 'contra'.
Could not read script 'C:\Users\ASUS\Documents\contra\node_modules#react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.
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 989ms
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\ASUS\Documents\contra\android\settings.gradle' line: 2
What went wrong:
A problem occurred evaluating settings 'contra'.
Could not read script 'C:\Users\ASUS\Documents\contra\node_modules#react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.
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 989ms
at makeError (C:\Users\ASUS\Documents\contra\node_modules\execa\index.js:174:9)
at C:\Users\ASUS\Documents\contra\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\ASUS\Documents\contra\node_modules\react-native\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\ASUS\Documents\contra\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
i try install it and uninstall it still cant run

react-native-appearance make a gradle error

Hey i have a error with gradle on my react native app (when i run yarn android)
yarn run v1.22.17
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 980 file(s) to forward-jetify. Using 32 workers...
info JS server already running.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\user\Documents\project react native\appfirst\node_modules\react-native-appearance\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':react-native-appearance'.
> Plugin with id 'maven' not found.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-appearance'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\user\Documents\project react native\appfirst\node_modules\react-native-appearance\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':react-native-appearance'.
> Plugin with id 'maven' not found.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-appearance'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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
at makeError (C:\Users\roro3\Documents\project react native\appfirst\node_modules\execa\index.js:174:9)
at C:\Users\roro3\Documents\project react native\appfirst\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\roro3\Documents\project react native\appfirst\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\roro3\Documents\project react native\appfirst\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I see a error with react-native-appearance but i don't understand why.
I got this error after instalation of some package (react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context #react-native-community/masked-view)
I also got into some problems with the react-native-appearence package. If you use expo you shouldn't have this problem or just update the package to version 0.3.4.
If you use use the react-native-cli the only option for you is to downgrade your react-native to a version which is using Gradle 6. You can find more information here about this issue.

How to run with --stracktrace option so that I can run react-native-cli project

I have a question about running React-native-cli project. When I ran this command: npx react-native run-android , it returned this result:
info Installing the app...
> Task :app:generatePackageList FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
* Where:
Script 'D:\IT\React.js\JAMK\e06Movies\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 131
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* 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.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Script 'D:\IT\React.js\JAMK\e06Movies\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 131
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* 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
at makeError (D:\IT\React.js\JAMK\e06Movies\node_modules\execa\index.js:174:9)
at D:\IT\React.js\JAMK\e06Movies\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async runOnAllDevices (D:\IT\React.js\JAMK\e06Movies\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\IT\React.js\JAMK\e06Movies\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
I have added --stacktrace in Android Studio by this instruction: "https://stackoverflow.com/questions/21674091/how-to-add-stacktrace-or-debug-option-when-building-android-studio-project" but it didn't work at all.
Can someone suggest to me some solutions for this problem? Thank you very much!!
npx react-native run-android --verbose

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.