A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$Task Action - react-native

I am very new to react native and I am just trying to build to a device. I keep getting a failed project at the point mentioned above the build seems to fail at this point "Execution failed for task ':app:processDebugResources'".
When I look at the build file for the android manifest there is a lot of errors, I have looked online but i cannot find anything. I have checked build.grade folder to ensure that the sdk tools and those numbers match and are installed as well as cleaning the project, rebuilding and syncing the gradle.
Any help would be very much appreciated I am just so new to all of this! below is the full code error message as well as a picture of the errors from the manifest.Picture of the errors in AndroidManifest.xml
BUILD FAILED in 33s
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:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$Task
Action
Android resource linking failed
ERROR:C:\Windows\System32\test\android\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml: A
APT: error: failed to load XML file: The system cannot find the file specified. (2).
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 33s
at makeError (C:\Windows\System32\test\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Windows\System32\test\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 (C:\Windows\System32\test\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Windows\System32\test\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

Related

macbook m1: error Failed to launch emulator

I use macbook m1 and set sdk in android studio.
I follow all the process: https://reactnative.dev/docs/environment-setup.
But I couldn't understand above process.
when I run this command line from terminal. It says
zsh: command not found: sdkmanager
So I pass that process.
Except for that, I installed all as doc says.
But when I run npx react-native run-android.
Error message below appears.
what is the problem?
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/hayat/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 3s
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/hayat/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 3s
at makeError (/Users/hayat/Documents/AwesomeProject/node_modules/execa/index.js:174:9)
at /Users/hayat/Documents/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/hayat/Documents/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/hayat/Documents/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
Running android emulator on m1 chip requires extra installation steps.
I recommend you to watch this video which might be helpful to your situation.
See this also.

Failed to create Jar file C:\Users\Fasih_khan\.gradle\caches\jars-8\d39c566f673fd9079bc7973003ab0a69\builder-4.2.2.jar

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.

react native compiling an app from github

Helo everyone, i'm new at react native and react. I'm trying to run a project from github, I keep getting this error. I tried many solutions but still getting it.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-push-notification:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 1m 11s
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
Note: Some input files use or override a deprecated API.
error Command failed with exit code 1.
Taking in consediration that when I start a new project, I can run it without any problem.
Thank you

How to fix "Program type already present: com.reactlibrary.BuildConfig" after installing Appodeal

Is there anyone who tried to install the Appodeal? I'm trying to install the Appodeal to our React Native 0.60 project but I encountered this error "Program type already present: com.reactlibrary.BuildConfig". I can't find which, where is something wrong.
Here's the plugin that I used.
https://github.com/appodeal/react-native-appodeal
Here's the error that I got:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.reactlibrary.BuildConfig
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 2m 36s
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-androi
Get more help at https://help.gradle.org
BUILD FAILED in 2m 36s
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 Note:
Some input files use or override a deprecated API. Note: Recompile
with -Xlint:deprecation for details. D8: Program type already present:
com.reactlibrary.BuildConfig
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.reactlibrary.BuildConfig
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 2m 36s
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (D:\Projects\Mobile\React Native\catholicconnect\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 run-android does not work. "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"

Just recently ejected expo and I'm trying to run my app on an android device. I followed the instructions (hopefuly right) but I keep getting this error when I try to run my 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:
A problem occurred configuring project ':app'.
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
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 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:
A problem occurred configuring project ':app'.
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
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 3s
at makeError (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:174:9)
at C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\#react-native-community\cli\build\index.js:186:9)
i am just using windows 7 32 bit i am also faced the same problem i solved like
you have local.properties file in your android folder or create one
in that file you have give sdk dir path like
give like this
sdk.dir=C:\\Users\\yourusername\\AppData\\Local\\Android\\Sdk
dont give like
sdk.dir=C:\Users\yourusername\AppData\Local\Android\Sdk
windows does not allow