gradlew assembleRelease it gives the following error in react-native - android

I want to make apk file of my application code, but whenever I am running gradlew assembleRelease it gives the following error, I just want to create the build with anything, as I have to deliver my project on Monday. Any help will be appreciated
C:\Users\dines\Documents\ANUJ\managementportal\android>gradlew assembleRelease
:ReactNative:Unexpected empty result of running '[node, undefined, config]' command.
:ReactNative:Running '[node, undefined, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\dines\Documents\ANUJ\managementportal\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 170
* What went wrong:
A problem occurred evaluating script.
> internal/modules/cjs/loader.js:584 throw err; ^Error: Cannot find module 'C:\Users\dines\Documents\ANUJ\managementportal\android\undefined' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Function.Module.runMain (internal/modules/cjs/loader.js:754:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
* 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 2s
C:\Users\dines\Documents\ANUJ\managementportal\android>

Follow This Step:
1) C:\Users\dines\Documents\ANUJ\managementportal> react-native run-android
2) C:\Users\dines\Documents\ANUJ\managementportal> cd android
3) C:\Users\dines\Documents\ANUJ\managementportal\android> ./gradlew assembleRelease
All Process is done after getting release app
Project folder > android > app > build > outputs > apk > release

Related

Cannot lock Build Output Cleanup Cache

I am having issues with my flutter project. Whenever I run the flutter build apk command. I get the following error message. I tried flutter clean but it does not solve the problem. Here is my error message.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not determine the dependencies of null.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().
> Cannot lock Build Output Cleanup Cache (C:\Users\JUSTINE NALWOGA\Desktop\EDUSELF FINAL\eduself\android\.gradle\buildOutputCleanup) as it has already been locked by this process.
* 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 5m 22s
Running Gradle task 'assembleRelease'... 337.9s
Gradle task assembleRelease failed with exit code 1
Try running this command in a terminal,
find ~/.gradle -type f -name "*.lock" -delete
or
Go to /.gradle folder and manually delete all files ending with .lock.
Then run flutter clean,
flutter pub get and finally run
flutter build apk.

How I run my react-native project(Failed to install the app. Make sure you have the Android development environment set up:

I trying to run my react-native anroid project. I use android 12 (S). And sdk verison 31.0.0. But i cant run my project.
My error :
PS C:\Users\omer2\OneDrive\Masaüstü\BosBirProje> npm run android
> BosBirProje#0.0.1 android
> react-native run-android
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
:ReactNative:Unexpected empty result of running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-n
ative-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\build\b
in.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\omer2\OneDrive\Masa�st�\BosBirProje\node_modules\#react-native-community\cli-platform-android\native_modu
les.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:998 throw err; ^Error: Cannot find module 'C:\Users\omer2\OneDrive\Masaüstü\BosBirP
roje\node_modules\#react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loade
r:995:15) at Module._load (node:internal/modules/cjs/loader:841:27) at Function.executeUserEntryPoint [as runMain] (
node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', require
Stack: []}Node.js v18.12.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
BU�LD FAILED in 6s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/do
cs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Unexpected empty result of running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-n
ative-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\build\b
in.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\omer2\OneDrive\Masa�st�\BosBirProje\node_modules\#react-native-community\cli-platform-android\native_modu
les.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:998 throw err; ^Error: Cannot find module 'C:\Users\omer2\OneDrive\Masaüstü\BosBirP
roje\node_modules\#react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loade
r:995:15) at Module._load (node:internal/modules/cjs/loader:841:27) at Function.executeUserEntryPoint [as runMain] (
node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', require
Stack: []}Node.js v18.12.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
BU�LD FAILED in 6s
at makeError (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\execa\index.js:174:9)
at C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\react-native\node_modules\#react-n
ative-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\b
uild\index.js:108:9)
info Run CLI with --verbose flag for more details.
I trying to react-native doctor and my react-native doctor output:
PS C:\Users\omer2\OneDrive\Masaüstü\BosBirProje> npx #react-native-community/cli doctor
Common
✓ Node.js
✓ npm
Android
✓ JDK
✓ Android Studio - Required for building and installing your app on Android
✖ Android SDK - Required for building and installing your app on Android
- Versions found: N/A
- Version supported: 31.0.0
✓ ANDROID_HOME
Errors: 1
Warnings: 0
Attempting to fix 1 issue...
Android
✔ Android SDK configured. You might need to restart your PC for all changes to take effect.
I reboot my pc as suggested and do npm run android. And my new output:
PS C:\Users\omer2\OneDrive\Masaüstü\BosBirProje> npm run android
> BosBirProje#0.0.1 android
> react-native run-android
info JS server already running.
info Installing the app...
:ReactNative:Unexpected empty result of running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-n
ative-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\build\b
in.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\omer2\OneDrive\Masa�st�\BosBirProje\node_modules\#react-native-community\cli-platform-android\native_modu
les.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:998 throw err; ^Error: Cannot find module 'C:\Users\omer2\OneDrive\Masaüstü\BosBirP
roje\node_modules\#react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loade
r:995:15) at Module._load (node:internal/modules/cjs/loader:841:27) at Function.executeUserEntryPoint [as runMain] (
node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', require
Stack: []}Node.js v18.12.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
BU�LD FAILED in 6s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/do
cs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Unexpected empty result of running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-n
ative-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\build\b
in.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\omer2\OneDrive\Masa�st�\BosBirProje\node_modules\#react-native-community\cli-platform-android\native_modu
les.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:998 throw err; ^Error: Cannot find module 'C:\Users\omer2\OneDrive\Masaüstü\BosBirP
roje\node_modules\#react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loade
r:995:15) at Module._load (node:internal/modules/cjs/loader:841:27) at Function.executeUserEntryPoint [as runMain] (
node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', require
Stack: []}Node.js v18.12.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
BU�LD FAILED in 6s
at makeError (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\execa\index.js:174:9)
at C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\react-native\node_modules\#react-n
ative-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\omer2\OneDrive\Masaüstü\BosBirProje\node_modules\#react-native-community\cli\b
uild\index.js:108:9)
info Run CLI with --verbose flag for more details.
1-) Finally I added the local.properties file to this location "C:\Users\omer2\OneDrive\Desktop\BosBirProject\android".
2-) I added the following commands in the gradle.properties file:
newArchEnabled=false
android.useAndroidX=true
android.enableJetifier=true
3-) I updated and reinstalled all npm packages
4-) I also tried to :
npm uninstall -g react-native-cli
npm install -g react-native-cli
npm install -g react-native
5-) I can't run the project even though I did all these, what would you recommend to me?

Cannot initialize React Native CLI Project

I am now using react native cli in my crud project,but after I initialized the project and ran npx react-native run-android inside project folder
it gave me these errors :
npx react-native run-android
info Starting JS server...
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
:ReactNative:Unexpected empty result of running '[node, C:\Users\invis\OneDrive\�?rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\invis\OneDrive\�?rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\invis\OneDrive\�rea de Trabalho\reac\app\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:988 throw err; ^Error: Cannot find module 'C:\Users\invis\OneDrive\�rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15) at Function.Module._load (node:internal/modules/cjs/loader:833:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:22:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
* 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
:ReactNative:Unexpected empty result of running '[node, C:\Users\invis\OneDrive\�?rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\invis\OneDrive\�?rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\invis\OneDrive\�rea de Trabalho\reac\app\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 413
* What went wrong:
A problem occurred evaluating script.
> node:internal/modules/cjs/loader:988 throw err; ^Error: Cannot find module 'C:\Users\invis\OneDrive\�rea de Trabalho\reac\app\node_modules\#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15) at Function.Module._load (node:internal/modules/cjs/loader:833:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:22:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
* 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:\Users\invis\OneDrive\Área de Trabalho\reac\app\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\invis\OneDrive\Área de Trabalho\reac\app\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:\Users\invis\OneDrive\Área de Trabalho\reac\app\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\invis\OneDrive\Área de Trabalho\reac\app\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
At first I installed react native and react-native-community-cli globally and I saw it was a bad practice so I uninstalled it globally and installed again but now locally
I saw in a website the command
react-native doctor
And I saw at first some problems with SDK so I installed all packages necessary and it still AFTER ALL THIS gives me the same error again and again
I also tried deleting node modules ang installing again with
npm install
but unfortunately it did not work,if anyone has any ideas please send it ,I will be very grateful !!!
After A LOT of research,I found out that because my path system is written in portuguese ,my desktop is named "Área de Trabalho" ,it did not worked,I changed it to OneDrive directory which is 1 level upper in the directory tree and it DID worked fine!!! Hope I helped someone with the same problem!!! Have a good day !!!

How can i fix 'npx react-native run-android' error?

I use 'npx react-native run-android' command and get this error:
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
:ReactNative:Unexpected empty result of running '[node, C:\Users\aisir\OneDrive\Рабочий стол\RNTestWithNode\clientRN\node_modules\#react-native-community\cli\build\bin.js, config]' command.
:ReactNative:Running '[node, C:\Users\aisir\OneDrive\Рабочий стол\RNTestWithNode\clientRN\node_modules\#react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\aisir\OneDrive\������� ����\RNTestWithNode\clientRN\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 195
* What went wrong:
A problem occurred evaluating script.
> internal/modules/cjs/loader.js:968 throw err; ^Error: Cannot find module 'C:\Users\aisir\OneDrive\Рабочий стол\RNTestWithNode\clientRN\node_modules\#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15) at Function.Module._load (internal/modules/cjs/loader.js:841:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
* 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 6s
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
:ReactNative:Unexpected empty result of running '[node, C:\Users\aisir\OneDrive\Рабочий стол\RNTestWithNode\clientRN\node_modules\#react-native-community\cli\build\bin.js, config]' command.
Does some one know how to fix it?
I found how to fix it. I changed the version of my project.

Jenkins build fails with error - Exit status of command '/var/../gradlew clean testStoreReleaseUnitTest assembleStoreRelease -p .' was 1 instead of 0

Getting Console Output of Jenkins build error as follow-
Exit status of command '/var/lib/jenkins/workspace/inkMobile-Android_master-YOSIH6EBA55H3BHM...PT7KXE7D7U4DPW6Q/gradlew clean testStoreReleaseUnitTest assembleStoreRelease -p .' was 1 instead of 0.
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/var/lib/jenkins/workspace/inkMobile-Android_master-YOSIH6EBA5....PW6Q/C:\androidStudio\sdk' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
I'm building my project on jenkins by clicking Build Now, but in second stage- Build & Test, error comes and build gets fail.
Can someone tell me what this error means?

Categories

Resources