I installed everything on my computer and also set all environment variables of path and android_home but I still got these error please help me to solve my problem. My android studio is also running and the emulator is running too but I don't get what's the problem while running my react native app.
C:\Users\Pandat\Desktop\React\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 JS server already running.
info Installing the app...
Task :app:processDebugManifest FAILED
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
10 actionable tasks: 2 executed, 8 up-to-date
C:\Users\Pandat\Desktop\React\AwesomeProject\android\app\src\debug\AndroidManifest.xml:7:7-38 Error:
Attribute application#name value=(com.example.app) from AndroidManifest.xml:7:7-38
is also present at AndroidManifest.xml:7:7-38 value=(com.awesomeproject.MainApplication).
Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml:8:5-14:43 to override.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application#name value=(com.example.app) from AndroidManifest.xml:7:7-38
is also present at AndroidManifest.xml:7:7-38 value=(com.awesomeproject.MainApplication).
Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml:8:5-14:43 to override.
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 39s
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
C:\Users\Pandat\Desktop\React\AwesomeProject\android\app\src\debug\AndroidManifest.xml:7:7-38 Error:
Attribute application#name value=(com.example.app) from AndroidManifest.xml:7:7-38
is also present at AndroidManifest.xml:7:7-38 value=(com.awesomeproject.MainApplication).
Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml:8:5-14:43 to override.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application#name value=(com.example.app) from AndroidManifest.xml:7:7-38
is also present at AndroidManifest.xml:7:7-38 value=(com.awesomeproject.MainApplication).
Suggestion: add 'tools:replace="android:name"' to element at AndroidManifest.xml:8:5-14:43 to override.
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 39s
at checkExecSyncError (child_process.js:610:11)
at execFileSync (child_process.js:628:15)
at runOnAllDevices (C:\Users\Pandat\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\Pandat\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Pandat\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\Pandat\Desktop\React\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:164:9)
May be you should rename your react native app and the project package by using this library
https://www.npmjs.com/package/react-native-rename
npm install react-native-rename
react-native-rename "Travel App" -b com.junedomingo.travelapp
You named your react-native project new ... and this is not a valid name for java-package (cause it is a keyword)...
The very last line of the error message shows
at async Command.handleAction (C:\Users\Pandat\Desktop\React\new\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:164:9)
You cannot have a keyword in your path name for the project so names like
com.new.project
com.class.sample
etc are not allowed
change your name to something which is not reserved
like C:\Users\Pandat\Desktop\React\sample
use react-native run-android instead of npx react-native run-android it works for me . hope it too will work for you. Fell free to ask for Doubts.
Related
At first was runing node 16.15 with JDK 18. thought it was a problem with the jdk. had to down grade to JDK 11. but still facing this problem. can any one help?
my virtual devices are already runing but for some reason i can
npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-
jetifier" flag.
Jetifier found 964 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
'"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...
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the
same AGP version. Class name for the included build object:
org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 up-to-date
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
'C:\aldoobi\newaldoobi\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 8s
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.
* 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
'C:\aldoobi\newaldoobi\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 8s
at makeError (C:\aldoobi\newaldoobi\node_modules\execa\index.js:174:9)
at C:\aldoobi\newaldoobi\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\aldoobi\newaldoobi\node_modules\#react-native-community\cli-
platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\aldoobi\newaldoobi\node_modules\#react-native-
community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
i have tried changing the path in my computer variables; i have added ANDROID_HOME, JAVA_HOME and also tried to change the android virtual deveces to SDK R but nothing . can any one help?
npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 982 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:
A problem occurred configuring root project 'food_shop'.
Failed to create Jar file C:\Users\Fasih_khan.gradle\caches\jars-8\d39c566f673fd9079bc7973003ab0a69\builder-4.2.2.jar.
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 41s
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.
What went wrong:
A problem occurred configuring root project 'food_shop'.
Failed to create Jar file C:\Users\Fasih_khan.gradle\caches\jars-8\d39c566f673fd9079bc7973003ab0a69\builder-4.2.2.jar.
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 41s
at makeError (E:\COURSES\Development\Shop\food_shop\node_modules\execa\index.js:174:9)
at E:\COURSES\Development\Shop\food_shop\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (E:\COURSES\Development\Shop\food_shop\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (E:\COURSES\Development\Shop\food_shop\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
For me error was like below
GradleException: Failed to create Jar file /root/.gradle/caches/jars-8/da1fb602f5e9c4589f7a774fa11d9312/bin.jar
Solution was : touch /root/.gradle/caches/jars-8/da1fb602f5e9c4589f7a774fa11d9312/bin.jar
If it will help.
I had similar issue but with different jar - spring-core-6.0.3.jar.
It looks like gradle hold a lock on cached files for some reasons while building your food_shop application.
Correct solution is to figure out which daemon process made a lock, then stop it calling gradle --stop and then restart gradle build again.
If it's not helped then check your locked cache files:
gradle --stop
check if lib already exists, it may looks like builder-4.2.2.jar.lock.lock
delete it if so.
run gradle build again for your project.
If you have dozen processes of gradle wrapper and it's difficult to figure out which one locked the file this solution would help.
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
Basically what I'm asking is if anyone knows how to install react-native-firebase and connect the project to firebase? It should be very easy but it's not working.
I'm using the docs here:
https://rnfirebase.io/#2-android-setup
But I'm installing react-native-firebase instead of react-native-firebase/app because I would like to use react-native-firebase SDK
I'm creating a new project using
npx react-native init newProject
then install the package:
npm install --save react-native-firebase
Then I create a new frebase project, add the google-services.json to the app folder, and add the module:
classpath 'com.google.gms:google-services:4.3.3'
(Android studio suggests using the latest version)
And:
apply plugin: 'com.google.gms.google-services'
After that I cannot run the project anymore.
It's stuck:
C:\Users\Omer\react-native1\haveri>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1034 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from C:\Users\Omer\react-native1\haveri\node_modules\react-native\android
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
<============-> 99% EXECUTING [1m 11s] > IDLE > IDLE > IDLE > IDLE > IDLE > :app:installDebug
> IDLE
> IDLE
If I'm using the version as indicated in the docs:
classpath 'com.google.gms:google-services:4.2.0'
I'm getting this error:
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 'C:\Users\Omer\react-native1\haveri\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx' 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 15s
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
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
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 'C:\Users\Omer\react-native1\haveri\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx' 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 15s
at makeError (C:\Users\Omer\react-native1\haveri\node_modules\execa\index.js:174:9)
at C:\Users\Omer\react-native1\haveri\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Omer\react-native1\haveri\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Omer\react-native1\haveri\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
This is all trying to install the react-native-firebase on a brand new project.
What am I doing wrong? How can I install it successfully?
Try running these commands. Then start try to run your app again
cd android
./gradlew clean
Try building Gradle from within Android studio. I found that this overcame some build problems sometimes when integrating with react-native-firebase. From Android studio, open your android project by navigating to your /Android folder in your RN project. Let Gradle start syncing and monitor for any errors details.
You may find that there are some JDK path related issues when launching your Android Studio. Try to troubleshoot any errors reported by Android Studio before building.
I have no idea what is the error when i want to run my react native app.
info Starting JS server...
info Installing the app...
> Task :app:processDebugManifest FAILED
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
10 actionable tasks: 3 executed, 7 up-to-date
/var/www/html/react/LotteryApp/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.
* 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 app:installDebug -PreactNativeDevServerPort=8081
/var/www/html/react/LotteryApp/android/app/src/debug/AndroidManifest.xml:22:18-91 Error:
Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-117 to override.
* 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:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/var/www/html/react/LotteryApp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/var/www/html/react/LotteryApp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
at then.result (/var/www/html/react/LotteryApp/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
It was working fine yesterday. I can't understand on the above code. What kind of error is this ? Please help on this. I tied to find on google. But cant find anything. Thanks in advance.
Did you build the app with Android studio once?
If not, build it first in Android Studio and install it through Android Studio.
To Build the app in android studio:
Open Android Studio.
Open react_native_project/android with Android Studio.
Wait for all it to build automatically, if some errors are present, try running Build > Clean Build.
Gradle should build successfully.
Then try:react-native run-android.
If it still does not work, stop the process and then run react-native start -- --reset-cache