React Native setting.gradle solved - reactjs

Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/home/dharmendra/Documents/gitlab/rnative/AwesomeProject/android/settings.gradle' (/home/dharmendra/.gradle/caches/7.5.1/scripts/6hrksilieebwgbc2tk6l5h8hd).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
* 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 30s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings generic class cache for settings file '/home/dharmendra/Documents/gitlab/rnative/AwesomeProject/android/settings.gradle' (/home/dharmendra/.gradle/caches/7.5.1/scripts/6hrksilieebwgbc2tk6l5h8hd).

I resolved this problem final only change JAVA Version 18 Use in java of version
Check java -version :- if showing 19.x.x then change java version 18.x.x install.
follow the step :
sudo apt update
sudo apt install -y openjdk-18-jdk
sudo apt install -y openjdk-18-jre
then run your project
npx react-native start && npx react-native run-android
.............................

Related

react native azure dev ops pipeline build failure

React native build fails in pipeline on IOS step
We run ios in the azure devops pipeline with npx react-native run-ios --configuration Release
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.201.1
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents:
npx react-native run-ios --configuration Release
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /Users/runner/work/_temp/ae9db986-f3a7-4f07-a6ba-d2250f5bfb5a.sh
info Found Xcode workspace "Navitus.xcworkspace"
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=3878, _LSFunction=_LSOpenStuffCallLocal}
error Command failed: open /Applications/Xcode_13.2.1.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID EA2BA6D4-C48C-4C19-A440-403677562929
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=3878, _LSFunction=_LSOpenStuffCallLocal}
.
Error: Command failed: open /Applications/Xcode_13.2.1.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID EA2BA6D4-C48C-4C19-A440-403677562929
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=3878, _LSFunction=_LSOpenStuffCallLocal}
at checkExecSyncError (child_process.js:790:11)
at Object.execFileSync (child_process.js:827:15)
at runOnSimulator (/Users/runner/work/1/s/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:208:28)
at Object.runIOS [as func] (/Users/runner/work/1/s/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:121:12)
at Command.handleAction (/Users/runner/work/1/s/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:192:23)
at Command.listener (/Users/runner/work/1/s/node_modules/commander/index.js:315:8)
at Command.emit (events.js:400:28)
at Command.parseArgs (/Users/runner/work/1/s/node_modules/commander/index.js:651:12)
at Command.parse (/Users/runner/work/1/s/node_modules/commander/index.js:474:21)
at setupAndRun (/Users/runner/work/1/s/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:271:24)
info Run CLI with --verbose flag for more details.
##[error]Bash exited with code '1'.
Finishing: iOS Build
To resolve "kLSNoExecutableErr: The executable is missing", you can try the following workarounds according to dsame:
retry:
steps:
- name: Open Simulator app
run: |
while ! open -Fn /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer/Applications/Simulator.app; do
echo "Retry"
done
echo "Success"
Update launch database:
steps:
- name: Open Simulator app
run: |
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer/Applications/Simulator.app
open -Fn /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer/Applications/Simulator.app
Reference: Launch Services database problems: correcting and rebuilding

How can I get React native to work on Mac Intel?

Tried so many things to get this to work, downloaded Android Studio and one of its emulators, downloaded brew and even ran: brew install android-platform-tools
I'm wondering if it's because I have to download these tools:
Android tools that are recommended for download
But I only have these tools available for download:
Some tools are missing for me
I want to try this solution but I'm having difficulties with it because control-o does not save: https://stackoverflow.com/a/68110432/19083668
This is the output of the terminal in VS Code when I run the app with ' npx react-native run-android '
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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 '/Users/charbelmansour/nativetest/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 16s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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 '/Users/charbelmansour/nativetest/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 16s
at makeError (/Users/charbelmansour/nativetest/node_modules/execa/index.js:174:9)
at /Users/charbelmansour/nativetest/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/charbelmansour/nativetest/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/charbelmansour/nativetest/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.

React-native running app error while gradle

I'm new to react-native and i went trough making my first app, and all good until i got to run it because i get this error, i would ¡be thankful if someone could help me, i did all the tutorial that react-native provide in it's page so i think i installed it correctly.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 870 file(s) to forward-jetify. Using 12 workers...
info Starting JS server...
/bin/sh: adb: command not found
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 determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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 '/Users/fovu/Documents/AwesomeProject/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 2s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> 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 '/Users/fovu/Documents/AwesomeProject/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 2s
at makeError (/Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:174:9)
at /Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
Hello and welcome to StackOverflow!
As the logs mention, it cannot compile you app since the location of your android SDK cannot be found.
> 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 '/Users/fovu/Documents/AwesomeProject/android/local.properties'.
It seems that your properties file points to a wrong SDK directory, your ANDROID_SDK_ROOT path points to a wrong directory or the ANDROID_SDK_ROOT path doesn't exist at all.
I'd recommend you to read through the official setup documentation and following each step: https://reactnative.dev/docs/environment-setup
Appendix
I have seen in your logs that react-native doesn't even see an emulator, hence this line:
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
So you need to either manually launch an emulator or if you don't have an android emulator, install one. Or if you want: You can try to install the app on your phone by plugging it into your computer and enable USB debugging on your phone.
Cheers.

processDebugResources FAILED after changing icon launcher

I change launcher icon in this address:
Projects\nameproject\android\app\src\main\res
And then linked them by this command:
npx react-native link
after re-building project by this command:
react-native run-android
I am getting following error:
> Task :app:processDebugResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with
Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:comman
d_line_warnings
108 actionable tasks: 5 executed, 103 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\Users\TORANJ\Desktop\Projects\insta\android\app\build\intermediates\merged_
manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher
_round (aka com.insta:mipmap/ic_launcher_round) not found.
error: failed processing manifest.
* 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 25s
error Failed to install the app. Make sure you have the Android development envi
ronment set up: https://facebook.github.io/react-native/docs/getting-started.htm
l#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8
081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\Users\TORANJ\Desktop\Projects\insta\android\app\build\intermediates\merged_
manifests\debug\AndroidManifest.xml:16: AAPT: error: resource mipmap/ic_launcher
_round (aka com.insta:mipmap/ic_launcher_round) not found.
error: failed processing manifest.
I ran gradlew clean but issue is persisting:
Does anybody have any idea how can i fix this?
I faced this same issue. It is because react-native android app icons run in round shaped. It shows build/ processDebugResources failed because we didn't add circle shaped app icon in res folder.
First, after creating a fresh project, look in the android/app/src/main/res folder, you will find ic_launcher & ic_launcher_round, right?
So, I suggest you to go Launcher icon generator to make two shaped icons (circle and square), paste them in icon folders with same name(ic_launcher & ic_launcher_round) and build the project.
You will find that app icon is updated.
I just copy ic_launcher and past it to same folder as ic_launcher_round. for example in mipmap-hdpi folder i just have an ic_launcher file and I manually copy and paste this, then run cd android && ./gradlew clean and run npx react-native link in root folder again, then rebuild the project again with npx react-native run-android command.

Getting an error while the project running on android

I'm trying run my project on android. But I get an error like that.
C:\Users\Alperen\Desktop\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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://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
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async Command.handleAction (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:164:9)
I don't understand. What should I do ?

Resources