I am trying to build an apk for android by using ionic framework but couldn't building an apk. I have already installed Android studio 3.1.3 and added platform in ionic project also.
ionic cordova add platform android
ionic cordova build android --release
Ionic info:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v8.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 7.2.1 Build version 7C1002
Environment Variables:
ANDROID_HOME : /Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk
Misc:
backend : pro
Error message:
ANDROID_HOME=/Users/prakash/Documents/adt-bundle-mac-x86_64-20140321/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
studio
(node:1272) UnhandledPromiseRejectionWarning: CordovaError: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
at Object.module.exports.check_gradle (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/check_reqs.js:150:18)
at StudioBuilder.prepEnv (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/builders/StudioBuilder.js:216:23)
at Api.module.exports.run (/Users/prakash/IONIC/NABH/platforms/android/cordova/lib/build.js:154:20)
at /Users/prakash/IONIC/NABH/platforms/android/cordova/Api.js:342:43
at _fulfilled (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:816:13)
at /Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:624:44
at runSingle (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/Users/prakash/IONIC/NABH/platforms/android/cordova/node_modules/q/q.js:125:13)
(node:1272) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1272) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Finally Installed gradle-4.1 file and unzipped it in below path,
/Users/prakash/gradle-4.1
But still getting the above message. Please help me to out from this stuck. Thanks in adv.