ionic cordova build android - Ionic Woocommerce app not build - ionic-framework

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.

Related

Unable to build android in IONIC 6

When I run ionic cordova build android –prod i get the error:
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.1.1-all.zip failed: timeout
I'm behind a proxy, so I set
ionic config set -g proxy http://proxy-..***:9999
I have executed ionic start myApp tabs --cordova --type=angular
I have executed ionic serve
but i can't do the build
I will be very grateful if you can help me please.
Ionic:
Ionic CLI: 6.20.3
Ionic Framework: #ionic/angular 6.3.2
Cordova:
Cordova CLI: 11.0.0
Cordova Platforms: android 10.1.2
Utility:
cordova-res: not installed globally
native-run: not installed globally
System:
NodeJS: v16.17.0 (C:\Program Files\nodejs\node.exe)
npm: 8.15.0
OS: Windows 10
Make sure you already added android in your ionic app then proceed on these steps.
Download the gradle: https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Place the zip file inside: {YourAppName}/platforms/android/gradle
Set an environment variable in your OS: CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="../gradle-7.1.1-all.zip"
Run ionic cordova build android --prod

Unable to build android apk file from 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.```

Cordova-camera plugin

When adding cordova camera plugin into my project then i am facing cordova build problem as follows:
Step 1: Adding ionic cordova camera plugins
Step 2: try to build the native app using ionic cordova build android --debug
then the following error is displaying
Task :app:transformClassesWithMultidexlistForDebug FAILED
D8: Program type already present: android.support.v4.app.ActionBarDrawerToggle$Delegate
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: Error while generating the main dex list:
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.ActionBarDrawerToggle$Delegate
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --debug exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
This problem may be from your AndroidManifest.xml. Open your AndroidManifest.xml file and find android.support.v4.app.ActionBarDrawerToggle, you will find two line for this. Comment one of them and keep only one android.support.v4.app.ActionBarDrawerToggle. Then try to run again.
This will may help you.
I change cordova-camera plugin version from 4.3.0 to 4.1.0 and now it works well this may be ionic v4 plugin issue
install the latest cordova platform[
]1

Problems when building in ionic cordova android

What went wrong:
A problem occurred configuring project ':CordovaLib'.
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
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 1s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':CordovaLib'.
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
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 1s
[ERROR] An error occurred while running subprocess cordova.
cordova build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information
I had the same problem and I tried many things.
I updated everything I could in Android Studio and SDK Manager. Gradle and Android Gradle Plugin got updated in the process - but this didn't help.
Then I updated cordova (from 8.1.2 to 9.0.0) and cordova-android (to 8.0.0) to latest versions - but this in itself didn't help either.
Only removing and re-adding android platform finally solved the issue:
npm install -g cordova#latest
npm install cordova-android#latest --save
ionic cordova platform remove android
ionic cordova platform check android
ionic cordova platform add android
Upgrade your version of cordova-android to the latest 7.1.3 and it will use the gradle plugin for android v3.3 which no longer checks for mips abi in the NDK.
also make sure to set the ANDROID_NDK_HOME environment variable to the location of your NDK.
Did two steps
1.Set ANDROID_HOME_NDK
2.Updated as answered by zbyl
npm install -g cordova#latest
npm install cordova-android#latest --save
ionic cordova platform remove android
ionic cordova platform check android
ionic cordova platform add android
And it worked.

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