简体   繁体   中英

Ionic Cordova Build Android No installed build tools found

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

  1. Downloaded Android Studio
  2. Downloaded the Android Sdk
  3. 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 (cordova-lib@8.1.1)
   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?

you need to install the build-tools 25.0.3 (just assuming it may require these):

sdkmanager packages "build-tools;25.0.3"

or even several build-tools versions ...

sdkmanager packages "build-tools;25.0.3" "build-tools;26.0.3" "build-tools;27.0.3" "build-tools;28.0.3"

如果你安装了 brew,你可以试试这个: brew install android-sdk这应该让你运行sdkmanager packages "build-tools;25.0.3"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM