Unable to build android apk file from ionic framework - ionic-framework

I am new to IONIC. My problem is that I am trying to build an apk file using downloaded project. I getting an error. Attaching my logs for reference. Any help would be great
Using this command to build apk ionic cordova build android --prod --release
> ionic-v1.cmd build
[17:21:38] Invoking sass gulp task.
> cordova.cmd build android --release
Running command: node E:\Ionic Projets\zmNinja-master\hooks\before_prepare\02_jshint.js E:\Ionic Projets\zmNinja-master
cordova-custom-config: Skipping auto-restore of config file backup(s)
Running command: node E:\Ionic Projets\zmNinja-master\hooks\after_prepare\010_add_platform_class.js E:\Ionic Projets\zmNinja-master
Running command: node E:\Ionic Projets\zmNinja-master\hooks\after_prepare\020_remove_sass_from_platforms.js E:\Ionic Projets\zmNinja-master
Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.```

Related

How to fix build failed issue in Ionic 3 for android?

When I try ionic cordova build android --prod --release command in Ionic 3, it shows an error
[12:24:50] ionic-app-script task: “build”
[12:24:50] Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
at /Users/angelamal/Documents/osome/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:237:55
at step (/Users/angelamal/Documents/osome/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
at Object.next (/Users/angelamal/Documents/osome/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
at fulfilled (/Users/angelamal/Documents/osome/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
[ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build --prod --target cordova --platform android exited
with exit code 1.
While I try to build an android app in Ionic 3.
I used this command ionic cordova build android --prod --release
But it is showing an error. How to solve this?
Thanks in Advance

ionic cordova build android - Ionic Woocommerce app not build

Ionic cordova build error
Command
cordova build android
Gives output:
Android Studio project detected
ANDROID_HOME=C:\Users\Clide\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.

How to solve Azure DevOps Ionic pipeline build error?

I'm trying to build Ionic framework using Hosted macOS agent in Azure DevOps pipeline. I have the below build steps.
install npm#latest -g (NPM)
install -g #ionic/app-scripts#latest --save-dev (NPM)
npm i -g ionic#latest --verbose (Ionic CLI )
build ios (Ionic CLI )
But I'm getting the below error.
2018-11-15T02:36:25.4788550Z ==============================================================================
2018-11-15T02:36:25.4788690Z Task : Ionic Command
2018-11-15T02:36:25.4788740Z Description : Run an Ionic CLI command
2018-11-15T02:36:25.4788770Z Version : 1.3.12
2018-11-15T02:36:25.4788800Z Author : Microsoft Corporation
2018-11-15T02:36:25.4788900Z Help : [More Information](http://go.microsoft.com/fwlink/?LinkID=692057)
2018-11-15T02:36:25.4788940Z ==============================================================================
2018-11-15T02:36:25.9506080Z Module cache at /Users/vsts/.taco_home/node_modules
2018-11-15T02:36:26.9844280Z cordova already installed.
2018-11-15T02:36:26.9845750Z Cordova Module Path: /Users/vsts/.taco_home/node_modules/cordova/8.1.2/node_modules/cordova
2018-11-15T02:36:26.9849330Z Module cache at /Users/vsts/.taco_home/node_modules
2018-11-15T02:36:27.9211450Z ionic already installed.
2018-11-15T02:36:27.9213230Z Ionic Module Path: /Users/vsts/.taco_home/node_modules/ionic/4.3.1/node_modules/ionic
2018-11-15T02:36:28.4726980Z [WARN] ionic build is for building web assets and takes no arguments. See ionic build --help.
2018-11-15T02:36:28.4727450Z
2018-11-15T02:36:28.4727570Z Ignoring argument ios. Perhaps you meant ionic cordova build ios?
2018-11-15T02:36:28.4727640Z
2018-11-15T02:36:28.5020530Z > ionic-app-scripts build
2018-11-15T02:36:30.8035540Z [02:36:30] ionic-app-scripts 3.2.0
2018-11-15T02:36:30.8054190Z [02:36:30] build dev started ...
2018-11-15T02:36:30.8621960Z [02:36:30] ionic-app-script task: "build"
2018-11-15T02:36:30.8622700Z [02:36:30] Error: ENOENT: no such file or directory, open
2018-11-15T02:36:30.8623700Z '/Users/vsts/agent/2.142.1/work/1/s/MyApp/node_modules/#angular/core/package.json'
2018-11-15T02:36:30.8630180Z Error: ENOENT: no such file or directory, open '/Users/vsts/agent/2.142.1/work/1/s/MyApp/node_modules/#angular/core/package.json'
2018-11-15T02:36:30.8632330Z at Error (native)
2018-11-15T02:36:30.8807840Z [ERROR] An error occurred while running subprocess ionic-app-scripts.
2018-11-15T02:36:30.8808230Z
2018-11-15T02:36:30.8809020Z ionic-app-scripts build exited with exit code 1.
2018-11-15T02:36:30.8809110Z
2018-11-15T02:36:30.8809730Z Re-running this command with the --verbose flag may provide more information.
2018-11-15T02:36:30.9233030Z ##[error]Task failed
2018-11-15T02:36:30.9263660Z ##[section]Finishing: Ionic Command build ios

how to fix ionic application error when we serve the application

When we run this command (ionic lab) then it show this error.
how we solve it..
ng run app:serve --host=0.0.0.0 --port=8100
[ng] The run command requires to be run in an Angular project, but a project definition could not be found.
[ERROR] ng has unexpectedly closed (exit code 1).
The Ionic CLI will exit. Please check any output above for error details.
check the command line if you are in the directory containing package.json and run the following commands:
npm install
ionic serve
It seems you are not inside the right folder. You have to run your ng run command in the same place your runned your ng new command (or wherever you have initialized your Angular project).

How to make a prod build in "Ionic upload" command?

I want to use Ionic deploy service in Ionic cloud.
When I run ionic upload command, a dev build is immediately triggered instead of prod build.
Is it possible to create a --prod build and upload?
One of major reasons is that multiple configurations in my code are bundled with --prod build only.
ionic upload --deploy=dev
[INFO] Running app-scripts build:
[09:55:59] build dev started ...
[09:55:59] clean started ...
[09:55:59] clean finished in 1 ms
You could pipe the npm scripts to run the ionic --prod first and then ionic upload
"scripts":{
"custom-upload":"ionic cordova build --prod | ionic upload"
}
and then run in the terminal
$: npm custom-upload
This will still run the dev build i think but your prod build should be packaged as well. It does not look like you can specify a build type in the ionic upload command, which makes me think that the ionic upload does not upload the production build to ionic view. And if that is that case then you might want to consider changing the configurations setup in a prod build to be set to only be used if not on localhost instead on based on the build.