I am having trouble building my ionic application on android on Ubuntu 16.04
This is step step what I have done in order to make it happen
- Downloaded Android Studio
- Downloaded the Android Sdk
in /.bashrc and /.bash_profile
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
When I hit sudo ionic cordova build android
I a getting this error:
FAILURE: Build failed with an exception.
- Where:
Script '/home/iraklis/Desktop/mus/platforms/android/CordovaLib/cordova.gradle' line: 68
- What went wrong:
A problem occurred evaluating project ':CordovaLib'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
this here is my ionic info:
Ionic:
ionic (Ionic CLI) : 4.6.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-rc.3
@angular-devkit/build-angular : 0.12.2
@angular-devkit/schematics : 7.1.4
@angular/cli : 7.1.4
@ionic/angular-toolkit : 1.2.2
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 9 other plugins)
System:
Android SDK Tools : 26.1.1 (/home/iraklis/Android/Sdk)
NodeJS : v10.11.0 (/usr/local/bin/node)
npm : 6.4.1
OS : Linux 4.15
I am thinking that.. maybe this here in cordova.gradle
String[] getAvailableBuildTools() {
def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
buildToolsDir.list()
.findAll { it ==~ /[0-9.]+/ }
.sort { a, b -> compareVersions(b, a) }
}
for some reason cannot find the build-tools..?
EDIT
I just noticed, when i do echo $ANDROID_HOME
it prints /home/iraklis/Android/Sdk
as expected but when i run ionic cordova build android
after building it prints ANDROID_HOME=/usr/lib/android-sdk
. How can i change that?