I am very new to React native app developer. Please help me to fix the below issue
I am facing the below issues while executing react-native run-android.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1112 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
'adb' 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...
Starting a Gradle Daemon (subsequent builds will be faster)
Task :app:processDebugResources FAILED
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
92 actionable tasks: 4 executed, 88 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Unable to delete directory 'E:\React Native\RNProjects\AHHCSTAFF\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx\appcompat' after 10 attempts
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 43s
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:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Unable to delete directory 'E:\React Native\RNProjects\AHHCSTAFF\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx\appcompat' after 10 attempts
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 43s
at makeError (E:\React Native\RNProjects\AHHCSTAFF\node_modules\execa\index.js:174:9)
at E:\React Native\RNProjects\AHHCSTAFF\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (E:\React Native\RNProjects\AHHCSTAFF\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (E:\React Native\RNProjects\AHHCSTAFF\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
I dont know how to fix all the above issues
I have met this error logs before. Here are my resolve steps:(executing in progect root dictory)
cd android
gradlew clean
And run yarn android,it works well.By the way,my RN version is 0.62. You can have a try.
Related
Hi i'm trying to use the camera with react-native-camera in react native but when i run the app it shows this error
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1165 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :react-native-camera:compileMlkitDebugJavaWithJavac FAILED
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.9/userguide/command_line_interface.html#sec:command_line_warnings
98 actionable tasks: 2 executed, 96 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-camera:compileMlkitDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
* 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 10s
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:
Execution failed for task ':react-native-camera:compileMlkitDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
* 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 10s
at makeError (/Users/calebgarcia/Dev/Tibeo/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/calebgarcia/Dev/Tibeo/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/calebgarcia/Dev/Tibeo/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/calebgarcia/Dev/Tibeo/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
I've had a lot of problems when trying to run the react native apps on android but in ios they run perfectly.
Do you guys have any idea how can i solve the error.
Thanks
firstly check whether what jdk version you have installed (got to terminal and check by java --version)
make sure u have added that jre path to your environment variables
if these condition already u have done then follow below link
[https://dev.to/larrydanny/could-not-find-tools-jar-4363][1]
your proble will be solved....
C:\Users\lenovo\Desktop\react-native-cli>cd AwesomeProject
C:\Users\lenovo\Desktop\react-native-cli\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Task :app:processDebugManifest FAILED
Error 'C:\Users\lenovo\Desktop\react-native-cli\AwesomeProject\android\app\build\outputs\logs\manifest-merger-debug-report.txt (Access is denied)' while writing the merger report file, build can continue but merging activities will not be documented
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.3/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugManifest'.
java.io.FileNotFoundException: C:\Users\lenovo\Desktop\react-native-cli\AwesomeProject\android\app\build\intermediates\manifest_merge_blame_file\debug\manifest-merger-blame-debug-report.txt (Access is denied)
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 34s
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
When I do react-native run-android I get this error:
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 6 workers...
info Starting JS server...
/bin/sh: 1: adb: 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...
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 4s
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 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
I dont get it, before I run my React Native app I open the Android emulator first. I also noticed that my android studio doesn't have 'configure' on welcome page, so I have to start a project if I want to acces the sdk manager and avd manager.
Try in the same terminal that you put npx react-native run-android , set environment variables again like :
source $HOME/.zprofile (if you use zsh)
source $HOME/.bash_profile (if you use bash)
MacBook-Air mlaapp % npx react-native run-android
warn The following packages use deprecated "rnpm" config that will stop working from next release:
- react-native-video: https://github.com/react-native-community/react-native-video#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1232 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
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 1s
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
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 1s
at checkExecSyncError (child_process.js:631:11)
at execFileSync (child_process.js:649:15)
at runOnAllDevices (/Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:179:41)
at /Users/varmabiraju/projects/Joshi/MyProjects/mlaapp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:133:12
at processTicksAndRejections (internal/process/task_queues.js:88:5)
at async Command.handleAction (/Users/varmabraju/projects/Joshi/MyProjects/mlaapp/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:182:9)
Try changing sdk versions in /android/build.gradle
compileSdkVersion = 30
targetSdkVersion = 30
from the comments, it seems that you are not using the gradle version 6.3. can you update your android build to use gradle 6.3 and see if the issue still persists?
another user faced a similar issue and reported this on github. you may want to take a closer look at it here.
This worked for me: Open task manager (of your OS) and kill adb.exe process. Now start adb again, now adb should start normally.
If this is your error
error for nativeDevServerPort
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
gradle 6.2 all zip causing this error for run-android please change or upgrade the distributionUrl version of gradle in
gradle-wrapper.properties to
distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
Hope this could help you in installing your react-native application in android
I can't run my project. There are 2 errors I'm trying to fix, but I get nothing.
I did everything that is written here:
https://facebook.github.io/react-native/docs/getting-started
C:\WINDOWS\system32>cd BabyMobile
C:\Windows\System32\BabyMobile>react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
> Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Windows\System32\BabyMobile\android\app\build\intermediates\res\merged\debug: error: directory 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 26s
9 actionable tasks: 1 executed, 8 up-to-date
error 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
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
C:\Windows\System32\BabyMobile>adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
Can you please help me?
**FIXED: updated android studio, project initialized in normal CMD(not as admin). The second problem was, that i turned on emulator after running react-natice run-android so you HAVE TO start emulator first !