Trouble linking libraries - react-native

I am trying to link this library called react-native-text-detector.
However, I consistently get an error saying Command failed: gradlew.bat installDebug
I have tried changing the '\' in settings.gradle to '/'. However, the same error still pops up
All I have been doing is this
react-native init textDetectorTesting
npm install --save react-native-text-detector
react-native link
This is the error I received
BUILD FAILED in 41s
42 actionable tasks: 42 executed
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:622:11)
at Object.execFileSync (child_process.js:640:13)
at runOnAllDevices (C:\Users\tanch\textdetector4\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (C:\Users\tanch\textdetector4\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (C:\Users\tanch\textdetector4\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process.internalTickCallback (internal/process/next_tick.js:77:7)

Related

Not Running React Native in my application

When I run "npx react-native run-android" it shows the follow message:
info JS server already running.
O sistema n�o pode encontrar o caminho especificado.
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...
ERROR: JAVA_HOME is set to an invalid directory: C:\Users\PABLO\AppData\Local\Android\Sdk
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
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
at makeError (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.
I really do not know what to do to run my android emulator, once I installed conform setting up development the documentation.

reactnative -PreactNativeDevServerPort=8081 android studio error

When i command npx react-native run-android,i get this error.Any solution?
> Task :react-native-community_netinfo:generateDebugRFile FAILED
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

Error Failed to install the app. Make sure you have the Android development environment set up

I created the react-native project, then open the folder, at the terminal; After running "npm start" and then "react-native run-android" I was able to run it on the virtual device. However, when I do this from the vscode terminal, I get the following error;
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
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 app:installDebug -PreactNativeDevServerPort=8081
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (/home/myworldsoftware-u/İndirilenler/project2/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/myworldsoftware-u/İndirilenler/project2/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/myworldsoftware-u/İndirilenler/project2/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npx react-native doctor
This command checks your environment and displays a report of the status of react-native installation. Check the output carefully for other software you might need to install
You should change distributionUrl in android/gradle/wrapper/gradle-wrapper.properties to
distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
You need to make focus on 2 files to check them ..either they are present or not or the code inside them is correct...
1.local.properties file
A.check that it is present or not..if yes go to step a2 or if not then:
a1. then inside the yourAppPath/Android/ you need to make a file with name local.properties
a2. And inside that put the path of android sdk
eg: sdk.dir=C\:\\Users\\UserNameDirectory\\AppData\\Local\\Android\\Sdk
B. inside yourAppPath/Android/setting.gradle
b1. check if not present then add include ':app'
Open android folder on android studio
Then wait of gradle build to complete
Issue solved
Put below line in your android/gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
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
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I have the same problem. At present, Android virtual machine can run normally, but running react-native run-android will cause such a problem

getting error gradlew.bat installDebug after installing react navigation and gesture handler

I create the new react native app using command react-native init appName.
After the app created successfully install it in my device using command react-native run-android, it installed successfully, and works fine... no issue
but as soon I install react navigation and gesture handler I am getting the error that Command failed: gradlew.bat installDebug after running command react-native run-android
I don't know what's wrong... my old react native projects are working perfectly fine.
I remember yesterday I run the command gradlew clean in one of my old project.. is this effecting on my new project?
I would be really thankful if someone helps
This is complete error
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle'.
> startup failed:
settings file 'D:\React Native Apps\Practice\newapp\android\settings.gradle': 3: unexpected char: '\' # line 3, column 133.
s\react-native-gesture-handler\android')
^
1 error
* 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 1s
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 (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (D:\React Native Apps\Practice\newapp\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Oh yeah, it´s a bug i think with RN 0.58 link command
open settings.gradle with a text editor from => 'D:\React Native Apps\Practice\newapp\android\settings.gradle'
replace all '\' with '/' , in my case i had to replace '..\node_modules\react-native-gesture-handler\android' with '../node_modules/react-native-gesture-handler/android'
then react-native run-android
Make sure you already have installed python 2 and last version of jdk And make sure you have already set ANDROID_HOME
And you should follow this structure : https://facebook.github.io/react-native/docs/getting-started.html

Error: Command failed: gradlew.bat installDebug on windows 8.1

I am creating the react-native app on windows 8.1 platform, while I am creating build using react-native run-android its giving me the following error. Please help me on the same.
Command failed: gradlew.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:611:11)
at Object.execFileSync (child_process.js:629:13)
at runOnAllDevices (E:\showTimes\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (E:\showTimes\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (E:\showTimes\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
create local.properties file in project root/android then add path to your SDK location
my case
sdk.dir = C:\\Users\\<userName>\\AppData\\Local\\Android\\sdk