I got the below error while build apk file in IONIC 3. Please give me a solution?

node:5396) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
ion id: 1): CordovaError: Failed to run “javac -version”, make sure that you ha
e a JDK installed.
ou can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
our JAVA_HOME is invalid: C:\Program Files (x86)\Java\jdk1.8.0_161\bin

My Ionic info

cli packages: (C:\Users\dell\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.1.6
Cordova Platforms  : android 7.0.0 browser 4.1.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.3
npm               : 5.5.1
OS                : Windows 7

Environment Variables:

ANDROID_HOME : C:\Users\dell\AppData\Local\Android\Sdk

Misc:

backend : pro

So then you should set your Java Environment Variable?

https://cordova.apache.org/docs/en/7.x/guide/platforms/android/#setting-environment-variables