Azure DevOps ionic Error building android - angularjs

While running Azure DevOps tasks for cordova to build android getting following error, but the same code build fine in local machine!
[ERROR] An error occurred while running subprocess cordova.
cordova platform add android#8.0.0 --verbose exited with exit code 1.
Even including --verbose doesnt give any more insights into whats went wrong! Any clues on resolving this?
Log :
2020-06-10T12:07:08.9595670Z Updating icons at platforms/android/app/src/main/res
2020-06-10T12:07:08.9595970Z Updating splash screens at platforms/android/app/src/main/res
2020-06-10T12:07:08.9596290Z This app does not have additional resource files defined
2020-06-10T12:07:08.9596560Z Prepared android project successfully
2020-06-10T12:07:08.9597390Z Executing script found in plugin cordova-plugin-add-swift-support for hook "after_prepare": plugins/cordova-plugin-add-swift-support/add-swift-support.js
2020-06-10T12:07:08.9597890Z Resolving module name for glob => glob
2020-06-10T12:07:08.9598130Z Saving android#8.0.0 into platforms.json
2020-06-10T12:07:08.9598640Z --save flag or autosave detected
2020-06-10T12:07:08.9598910Z Saving android#~8.0.0 into config.xml file ...
2020-06-10T12:07:08.9599200Z adding android to cordova.platforms array in package.json
2020-06-10T12:07:08.9599480Z No scripts found for hook "after_platform_add".
2020-06-10T12:07:08.9599780Z [ERROR] An error occurred while running subprocess cordova.
2020-06-10T12:07:08.9600000Z
2020-06-10T12:07:08.9600570Z cordova platform add android#8.0.0 --verbose exited with exit code 1.
2020-06-10T12:07:08.9600850Z
2020-06-10T12:07:08.9601610Z Re-running this command with the --verbose flag may provide more information.
2020-06-10T12:07:08.9602390Z 2020-06-10T12:07:08.134Z ionic:utils-process onBeforeExit handler: 'process.exit' received
2020-06-10T12:07:08.9603200Z 2020-06-10T12:07:08.134Z ionic:utils-process onBeforeExit handler: running 1 functions
2020-06-10T12:07:08.9603970Z 2020-06-10T12:07:08.162Z ionic:utils-process processExit: exiting (exit code: 1)
2020-06-10T12:07:08.9604510Z [0m]

Related

Ionic build failed without specific error

After cloning my Ionic React project to my server, I ran npm install and all dependencies were installed as expected.
But when I tried to build my app running sudo ionic build --verbose, it tooks much more time than usual and ended like this :
eslint:lint-result-cache Persisting cached results: /var/www/html/ms-users-front/node_modules/.cache/.eslintcache +0ms
eslint:cli-engine Linting complete in: 4827ms +48ms
//It stay here for at least 10min before to failed while it tooks 1min in my local machine.
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
[ERROR] An error occurred while running subprocess react-scripts.
react-scripts build exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 1 functions +1ms
ionic:utils-process processExit: exiting (exit code: 1) +44ms
My server is an ec2 instance with httpd installed and everything was working great before I tried to build a new version yesterday.
With exactly the same process, the app is building perfectly on my local machine...
I tried npm update, delete eslint cache, and build but without success.
I tried to downgrade Typescript to 4.1 because I had a warning saying that Typescript should be >4.5 and it was 4.7. But after some tests on local, it looks like this has no incidence on the build process.
I'm totally stuck and I absolutly don't know what to try.

React-native running app error while gradle

I'm new to react-native and i went trough making my first app, and all good until i got to run it because i get this error, i would ¡be thankful if someone could help me, i did all the tutorial that react-native provide in it's page so i think i installed it correctly.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 870 file(s) to forward-jetify. Using 12 workers...
info Starting JS server...
/bin/sh: adb: command not found
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...
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/fovu/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 2s
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/fovu/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 2s
at makeError (/Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:174:9)
at /Users/fovu/Documents/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/fovu/Documents/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
Hello and welcome to StackOverflow!
As the logs mention, it cannot compile you app since the location of your android SDK cannot be found.
> 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/fovu/Documents/AwesomeProject/android/local.properties'.
It seems that your properties file points to a wrong SDK directory, your ANDROID_SDK_ROOT path points to a wrong directory or the ANDROID_SDK_ROOT path doesn't exist at all.
I'd recommend you to read through the official setup documentation and following each step: https://reactnative.dev/docs/environment-setup
Appendix
I have seen in your logs that react-native doesn't even see an emulator, hence this line:
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
So you need to either manually launch an emulator or if you don't have an android emulator, install one. Or if you want: You can try to install the app on your phone by plugging it into your computer and enable USB debugging on your phone.
Cheers.

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.

Deploy React JS SPA in Openshift

I have build a React JS app and triggered yarn build command. Its builded successfully and if I run yarn global add serve, its working perfectly on http://localhost:5000. After that I tried below link to deploy this code to OpenShift.
OpenShift Deployment
According to the document, I tried to run npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.13.0 --build.env YARN_ENABLED=true --expose
Then I got this log -
npx: installed 216 in 37.284s
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:25:35
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\index.js:23:39
2019-12-21T11:58:07.841Z INFO loading configuration
kubernetes-client deprecated fromKubeconfig see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\nodeshift-config.js:35:32
2019-12-21T11:58:07.882Z INFO using namespace smart-learner at https://c101-e.jp-tok.containers.cloud.ibm.com:30512
kubernetes-client deprecated Client({ config }), see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:95:18
kubernetes-client deprecated Request() without a .kubeconfig option, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\kubernetes-client\lib\swagger-client.js:200:19
2019-12-21T11:58:07.928Z WARNING a file property was not found in your package.json, archiving the current directory.
2019-12-21T11:58:07.929Z INFO creating archive of .gitignore, build, Dockerfile, package-lock.json, package.json, public, README.md, src, yarn.lock
2019-12-21T11:58:09.001Z INFO using existing build configuration smartlearner-s2i
2019-12-21T11:58:09.377Z INFO using existing image stream smartlearner
2019-12-21T11:58:09.378Z INFO uploading binary archive C:\ReactAPP\smartlearner/tmp/nodeshift/build/archive.tar
2019-12-21T11:58:15.825Z INFO binary upload complete
2019-12-21T11:58:15.828Z INFO waiting for build to finish
kubernetes-client deprecated .getStream use .getByteStream, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\build-watcher.js:56:107
2019-12-21T11:58:19.798Z TRACE Using bucharestgold/centos7-s2i-web-app:10.x as the s2i builder image
2019-12-21T11:58:20.550Z TRACE ls: cannot access /tmp/src/node_modules: No such file or directory
2019-12-21T11:58:20.564Z TRACE ---> Installing application source
2019-12-21T11:58:20.585Z TRACE ---> Building your Web Application from source
2019-12-21T11:58:20.592Z TRACE Current git config
2019-12-21T11:58:20.620Z TRACE url.https://github.com.insteadof=git#github.com:
2019-12-21T11:58:20.629Z TRACE url.https://.insteadof=ssh://
2019-12-21T11:58:20.629Z TRACE url.https://github.com.insteadof=ssh://git#github.com
2019-12-21T11:58:20.630Z TRACE ---> Using 'yarn install' with YARN_ARGS
2019-12-21T11:58:21.356Z TRACE yarn install v1.10.1
2019-12-21T11:58:21.594Z TRACE warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2019-12-21T11:58:21.657Z TRACE [1/4] Resolving packages...
2019-12-21T11:58:23.111Z TRACE [2/4] Fetching packages...
2019-12-21T11:58:53.081Z TRACE error #typescript-eslint/eslint-plugin#2.10.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.12.0"
2019-12-21T11:58:53.083Z TRACE error Found incompatible module
2019-12-21T11:58:53.086Z TRACE info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2019-12-21T11:58:58.441Z TRACE error: build error: non-zero (13) exit code from bucharestgold/centos7-s2i-web-app:10.x
2019-12-21T11:59:00.497Z ERROR build failed with message: Assemble script failed.
2019-12-21T11:59:00.503Z ERROR Assemble script failed.
i am not able to understand what I am missing here. I found that bucharestgold/centos7-s2i-web-app has been depreicated and tried with npx nodeshift --strictSSL=false --dockerImage=nodeshift/ubi8-s2i-web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000 --expose. This is also throwing same error message.
You can use the new web-app flag feature and let nodeshift set the appropriate docker image.
Try running this command instead npx nodeshift --web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000

React Native android build FAILD :app:mergeReleaseResources

The App is working fine, in fact I have built 2 release APKs. This time I modified the code and came to do ./gradlew assembleRelease and I got the following error:
Error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
Expectation
To generate a healthy APK ready to publish.
Extra Info
I have done the signing and the .keystore in the right place ../android/app
Updated ../android/gradle.properties as instructed
Here is the complete stacktrace:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeReleaseResources'.Close stacktrace
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:79)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Screenshot from the Scan1
Screenshot from the Scan2
Screenshot from the Scan3
from android Studio - I believe it is related to the issue
Screenshot from the Scan4
I believe this could be a duplicate of this question:
Error Execution failed for task ':app:mergeReleaseResources' building APK
The problem occured becaused when I tried to build once, it has
created drawables dirs on android/app/src/main/res/. Then when I tried
on second time, it has shown me this error Execution failed for task
':app:mergeReleaseResources' building APK
I just deleted the drawable-* dirs and it worked.
To remove the directory drawable--*:
rm -rf android/app/src/main/res/drawable-*
There is no drawable folder inside res, still the error occurs.
While running the emulator the build is successful and emulator works fine but I couldn't take release apk because of build failure.

Resources