BUILD FAILED REACT NATIVE (Not generating apk) - react-native

I am getting an error while generating apk file: Error says: Error: EEXIST: file already exists, mkdir 'C:\Users\Amna'
error EEXIST: file already exists, mkdir 'C:\Users\Amna'. Run CLI with --verbose flag for more details.
Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Process 'command 'npx.cmd'' finished with non-zero exit value 1
Can you please guide me through this error, and what might cause this error???
With this command gradlew assembleRelease -x bundleReleaseJsAndAssets, it creates apk file but app crashes, I am unable to understand what is causing such issue.

Related

ReactNativeFirebase WARNING: NPM package '#react-native-firebase/auth' depends on '#react-native-firebase/app'

I downloaded a pre-made react native app I want to add features to, ran npm install and upon npx react-native run-android I receive an error related to a Firebase of which I do not know how to solve:
Task :app:processDebugResources FAILED
ReactNativeFirebase WARNING: NPM package '#react-native-firebase/auth' depends on '#react-native-firebase/app' v9.0.0 but found v8.4.7, this might cause build issues or runtime crashes.
ReactNativeFirebase WARNING: NPM package '#react-native-firebase/crashlytics' depends on '#react-native-firebase/app' v9.0.0 but found v8.4.7, this might cause build issues or runtime crashes.
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
Android resource linking failed
C:\Users\User.gradle\caches\transforms-2\files-2.1\6fece3a17ebf272ec36b2203e58d733a\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
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.
BUILD FAILED in 2m 18s
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
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
I want install and run this pre made react native app in my android phone.

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

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.

React-native package Release error while ./gradlew assembleRelease

Task :app:packageRelease FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:packageRelease'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
java.io.IOException: Execution of compression failed.
Try cleaning the project using ./gradlew clean and rebuilding the project...
If doesn't work then, show the error log in details...

React Native Android build : Process 'command 'npx.cmd'' finished with non-zero exit value 1

I keep getting this error when trying to generate the APK for my project. I use react native 0.61.5 and I don't install any library.
C:\Users\Ali\Desktop\Desktop\My work\ReactNative\AwesomeProject61\android>gradle
w bundleRelease
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
info Writing bundle output to:, C:\Users\Ali\Desktop\Desktop\My
info Writing sourcemap output to:, C:\Users\Ali\Desktop\Desktop\My
info Done writing sourcemap output
info Done writing bundle output
info Copying 1 asset files
Error: EEXIST: file already exists, mkdir 'C:\Users\Ali\Desktop\Desktop\My'
error EEXIST: file already exists, mkdir 'C:\Users\Ali\Desktop\Desktop\My'. Run
CLI with --verbose flag for more details.
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'npx.cmd'' finished with non-zero exit value 1
* 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 14s
1 actionable task: 1 executed
C:\Users\Ali\Desktop\Desktop\My work\ReactNative\AwesomeProject61\android>
Have you tried cleaning your Gradle?
Please try this command cd android && ./gradlew clean run this command on your project's root directory! or ./gradlew clean in your project's android folder.
after that recompile the App .
If the above solution does not help, try building your release with this command, go to your android folder and run command ./gradlew assembleRelease -x bundleReleaseJsAndAssets
The following command works for me:
gradlew assembleRelease -x bundleReleaseJsAndAssets
Try to install Watchman
Then cd android && ./gradlew app:assembleRelease
Removing the space in one of the folders of the project directory solved this issue for me.
from D:\Work Stuff\Project\android
to D:\WorkStuff\Project\android
Then I ran:
./gradlew clean
./gradlew --stop
Afterwards ./gradlew bundleRelease succeeded.
you can try:
.\gradlew app:assembleRelease -x bundleReleaseJsAndAssets
after accordingly install and deploy the keystore file based on documentation use the following line of command to build apk
.\gradlew app:assembleRelease -x bundleReleaseJsAndAssets
update your Visual C++ and it will fix the issue.
you can download it using this link: The latest supported Visual C++ downloads

react-native-maps:processReleaseResources task gradlew build failed

I check already all similar answers from Stack and also I lookup on GitHub Issues but without any luck.
Problem occur when I install react-native-maps plugin, during a build I receive gradlew exception
:react-native-maps:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-maps:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1
Google Maps API is correctly added into AndroidManifest file.
One additional remark I see also many warnings like
...\node_modules\react-native-maps\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.8.0\res\drawable\common_google_signin_btn_text_light_focused.xml:14:29-81 : No resource found that matches the given name (at 'drawable' with value '#drawable/common_google_signin_btn_text_light_normal').
However in build.gradle I add dependencies for
compile 'com.google.android.gms:play-services-base:10.0.1'
Any ideas how to resolve a problem?
I had the same error recently and should have paid more attention to the error message. Message clearly states it out. Failure to execute aapt
Short Answer:
Make aapt executable
Slightly Longer Answer:
1) Run cd android && ./gradlew clean && ./gradlew assembleDebug --stacktrace. The output will show the build-tool version where you will locate the right aapt to make executable and the path to it. e.g Cannot run program "/home/user/Android/Sdk/build-tools/25.0.3/aapt" (in directory "/home/user/testproject/node_modules/react-native-maps/lib/android"): error=13, Permission denied
2) Right click on file 'aapt', click on permissions, click the checkbox marked 'Execute'
3) Run ./gradlew clean && ./gradlew assembleDebug again and you should be good to go!!!
Problem solved.
An issue is a to long file path and npm not properly install react-native-maps module (there wasn't all required resource files).
During "compilation"
react-native run-android
gradlew task fails du to missing resources in maps module
I experienced a similar issue with this error response:
:react-native-maps:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-maps:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
The way I was able to resolve this error was by going into folder node_modules/react-native-maps/lib/android and editing the build.gradle file with the corresponding compileSdkVersion, buildToolsVersion, minSdkVersion, and targetSdkVersion from my {root}/android/app level build.gradle versions.
This fix worked in various other newly installed packages which caused an error upon attempting to react-native run-android. Hope this helps!