React native app failed to build while trying to bundle release - reactjs

I created an app which worked perfectly on debug but when i run
./gradlew assembleRelease
the build failed to complete.
Below is the error I receive.
at ModuleResolver.resolveDependency (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:136:15)
at DependencyGraph.resolveDependency (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\node-haste\DependencyGraph.js:231:43)
at Object.resolve (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
info Run CLI with --verbose flag for more details.
?[0K
?[0K
?[0K
?[3A?[1m<?[0;32;1m=?[0;39;1m------------> 13% EXECUTING [2m 37s]?[m?[38D?[1B?[1m> :app:bundleReleaseJsAndAssets?[m?[31D?[1B> IDLE?[6D?[1B?[3A?[0K
?[31;1m> Task :app:bundleReleaseJsAndAssets?[0;39m?[31m FAILED?[39m
?[1B?[0K
?[0K
?[3A?[1m<?[0;31;1m=?[0;39;1m------------> 13% EXECUTING [2m 37s]?[m?[38D?[1B> IDLE?[6D?[1B> IDLE?[6D?[1B?[3A?[0K
?[31mFAILURE: ?[39m?[31mBuild failed with an exception.?[39m
?[0K
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
?[33m> ?[39mProcess 'command 'cmd'' finished with non-zero exit value 1
* Try:
?[33m> ?[39mRun with ?[1m--stacktrace?[m option to get the stack trace.
?[33m> ?[39mRun with ?[1m--info?[m or ?[1m--debug?[m option to get more log output.
?[33m> ?[39mRun with ?[1m--scan?[m to get full insights.
* Get more help at ?[1mhttps://help.gradle.org?[m
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.4.2/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
?[31;1mBUILD FAILED?[0;39m in 2m 41s
24 actionable tasks: 2 executed, 22 up-to-date
?[0K
?[0K
?[0K
?[3A?[1m<?[0;1m-------------> 0% WAITING?[m?[26D?[1B> IDLE?[6D?[1B> IDLE?[6D?[1B?[3A?[2K?[1B?[2K?[1B?[2K?[2A
The graddle drama has been there since I first installed the react native framework, and all solution to get it fixed has yielded nothing. However, like I said early, I'm able to get the app run on emulators; even on physical device, the debug apk worked perfectly.
Help is appreciated

try this,
Close metro server if is opend
watchman shutdown-server
for delete node-modules and re install and clear-cache
watchman watch-del-all && rm -rf node_modules && npm cache clean --force && yarn install && npm start -- --reset-cache
3.after complete close the metro server, then next run this code
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
finally npx react-native run-android or yarn android

Did you try to re-bundle the entry file ?
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Here's an issue that seems related to yours: React-Native assembleRelease fails for task ':app:bundleReleaseJsAndAssets'

Related

React Native setting.gradle solved

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
.............................

How to solve Command "yarn run build" exited with 1 Error!?

I've created my vercel app before, but when I tried to update with vercel --prod, I got
Error! Command "yarn run build" exited with 1
Error! Check your logs...
When I check my logs I got it, but I do not understand what to do with them because I had others empty vars, for example, but it was not a problem.
16:02:07.366 Retrieving list of deployment files...
16:02:08.837 Downloading 25 deployment files...
16:02:09.301 Analyzing source code...
16:02:10.840 Installing build runtime...
16:02:13.806 Build runtime installed: 2.965s
16:02:17.056 Looking up build cache...
16:02:19.686 Build cache downloaded [24.72 MB]: 2226.563ms
16:02:20.981 Detected package.json
16:02:20.982 Installing dependencies...
16:02:21.305 yarn install v1.22.17
16:02:21.420 [1/4] Resolving packages...
16:02:22.236 success Already up-to-date.
16:02:22.241 Done in 0.94s.
16:02:22.515 Running "yarn run build"
16:02:22.752 yarn run v1.22.17
16:02:22.793 $ react-scripts build
16:02:24.503 Creating an optimized production build...
16:02:25.419 Browserslist: caniuse-lite is outdated. Please run:
16:02:25.419 npx browserslist#latest --update-db
16:02:25.420
16:02:25.420 Why you should do it regularly:
16:02:25.420 https://github.com/browserslist/browserslist#browsers-data-updating
16:02:29.686
16:02:29.686 Treating warnings as errors because process.env.CI = true.
16:02:29.687 Most CI servers set it automatically.
16:02:29.687
16:02:29.687 Failed to compile.
16:02:29.687
16:02:29.688 src/App.js
16:02:29.688 Line 7:20: 'setProducts' is assigned a value but never used no-unused-vars
16:02:29.688
16:02:29.688 src/components/CartProduct/index.jsx
16:02:29.688 Line 7:17: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.688
16:02:29.689 src/components/Product/index.jsx
16:02:29.691 Line 7:13: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.691
16:02:29.691
16:02:29.714 error Command failed with exit code 1.
16:02:29.714 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
16:02:29.732 Error: Command "yarn run build" exited with 1
In your eslint config file, turn off no-unused-var
"rules": {
.....
"no-unused-vars": "off"
.....
}
and add Alt for your images tags with or without text:
<img src="[image url]" alt="" />

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.

Module not found: Can't resolve './.htaccss' after installing React-boilerplate Dandelion starter project

I have downloaded Dandelion starter-project and decompressed it on a local folder. I ran:
npm i
npm run build:dll
and then
npm start
then it complains:
> dandelion_pro#1.6.1 start /home/......./dandelion/starter-project
> cross-env NODE_ENV=development node server
Happy[js]: Version: 5.0.1. Threads: 5 (shared pool)
Server started ! ✓
Access URLs:
-----------------------------------
Localhost: http://localhost:3001
LAN: http://xxx.xxx.xxx.xxx:3001
-----------------------------------
Press CTRL-C to stop
Webpack is building script...
Happy[js]: All set; signaling webpack to proceed.
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
webpack built 920e70412c607c0d50a6 in 3600ms
✖ 「wdm」:
ERROR in ./app/app.js
Module not found: Error: Can't resolve './.htaccess' in '/home/......./dandelion/starter-project/app'
# ./app/app.js 27:0-48
# multi ./node_modules/react-app-polyfill/ie11.js webpack-hot-middleware/client?reload=true ./app/app.js
I have searched the web looking for a solution, but I was unable to find one. My system is a Ubuntu 18.04.3 based machine running Linux Mint 19.3, nodejs 12.15.0 and npm 6.13.4. How can I solve this?
Well folks after an endless unsuccessful search on the web I created an empty ´.htaccess´ file and placed it into the ´app´ folder. Maybe this is not the better or the elegantest way to do it, but it worked for me.
I am posting this hoping it might be helpful.

yarn install error:Failed to download Chromium

The Yarn install failed to download Chromium. Error is as follows:
D:\workspace\www\ant-design-mobile-pro
λ yarn
yarn install v1.12.3
//...
Directory: D:\\workspace\\www\\ant-design-mobile-pro\\node_modules\\puppeteer
Output:
ERROR: Failed to download Chromium r599821! Set \"PUPPETEER_SKIP_CHROMIUM_DOWNLOAD\" env variable to skip download.
{ Error: connect ETIMEDOUT 172.217.161.176:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.217.161.176',
success Saved lockfile.
Done in 343.80s.
Question:
Can I download Chromium manually? I can download it from https://npm.taobao.org/mirrors/chromium-browser-snapshots/Win_x64/,the question is: Where should I put it after dowloading it?
If you don't intend to run the automated browser tests which depend upon Chromium, you can skip the install per the error message:
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true && yarn
I've occasionally encountered this yarn install timeout recently as well, and no cache clear or other manipulation has seemed to resolve it.

Resources