I can't build app and get apk file in ionic 3

When I do build for project it doesn’t export apk file and give me this error

Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning.
[17:26:00] sass finished in 882 ms
[17:26:00] postprocess started …
[17:26:00] postprocess finished in 8 ms
[17:26:00] lint started …
[17:26:00] build dev finished in 8.84 s

cordova build android --release
Android Studio project detected

(node:3466) UnhandledPromiseRejectionWarning: CordovaError: ‘ANDROID_HOME’ environment variable is set to non-existent path: /home/hsen/home/hsen/Android/Sdk
Try update it manually to point to valid SDK directory.
at /home/hsen/Desktop/myApp/platforms/android/cordova/lib/check_reqs.js:309:19
at _fulfilled (/home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:816:13)
at /home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:877:14
at runSingle (/home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/home/hsen/Desktop/myApp/platforms/android/cordova/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
(node:3466) 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:3466) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. Inthe future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[17:26:03] lint finished in 2.53 s


Pretty self explaining error message, isn’t it?

1 Like

How i can fix this in Ubuntu?

Set the environment variable to a path that exists and holds your Android SDK location.

Where I can set environment variable ?

Google “ubuntu set environment variable”

1 Like