How to set ANDROID_HOME environment variable in ubuntu 16.04

I am facing this error while running the java mobile automation test case with appium

mvn -Dtest=SavedPhotosTest  test -DFILEPATH="sample.apk"

An unknown server-side error occurred while processing the command.
Original error: packageAndLaunchActivityFromManifest failed. Original
error: Could not find aapt Please set the ANDROID_HOME environment
variable with the Android SDK root directory path. (WARNING: The
server did not provide any stacktrace information)

I’ve set the ANDROID_HOME in my .bashrc already

export ANDROID_HOME=/home/user/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools

appium is also running on the another terminal

Configurations:

IntelliJ IDE –> ideaIC-2017.2.4 Android-studio –>
android-studio-ide-162.4069837-linux appium –> 1.7.1

I’ve already tried the following links:

https://discuss.appium.io/t/error-could-not-find-aapt/671/5
Could not find aapt with appium server

https://discuss.appium.io/t/error-could-not-find-aapt/671

How to set IntelliJ IDEA Project SDK

I need a quick fix for this issue. Kindly help