i’m unable to build the app

1.43K views
0

Hello,

i tried to build he app or android ( generate a apk file)

by using the command

ionic cordova build android –prod –release

But it does not work

cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version ’27.+’ to /home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/app/build.gradle
cordova-android-support-gradle-release: Wrote custom version ’27.+’ to /home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova-android-support-gradle-release/italiancoders-cordova-android-support-gradle-release.gradle
Executing script found in plugin cordova-plugin-add-swift-support for hook “after_prepare”: plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
No scripts found for hook “before_compile”.
Failed to find ‘JAVA_HOME’ environment variable. Try setting it manually.
CordovaError: Failed to find ‘JAVA_HOME’ environment variable. Try setting it manually.
at /home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/lib/check_reqs.js:176:31
at _fulfilled (/home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:834:54)
at /home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:863:30
at Promise.promise.promiseDispatch (/home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:796:13)
at /home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:857:14
at runSingle (/home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/home/sankara/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code/platforms/android/cordova/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11)
[ERROR] An error occurred while running subprocess cordova.

cordova build android –release –verbose 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 2 functions +0ms
ionic:utils-process processExit: exiting (exit code: 1) +13ms
sankara@sankara:~/Downloads/customlistingapp_v1-4-2 (copy 1)/Custom Listing App – Ionic Code$ sudo ionic cordova build android –prod –release –verbose

Ionic:

Ionic CLI : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 4.1.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.4.1

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.2.1, (and 17 other plugins)

Utility:

cordova-res (update available: 0.15.1) : 0.6.0
native-run : not installed

System:

NodeJS : v10.21.0 (/usr/bin/node)
npm : 6.14.5
OS : Linux 5.6

Answered question
Sorry, you do not have permission to read comments.