1

Premise: I've looked for every answer on here, tried everything but but I keep getting the same error, really stuck at this point. I'm trying to build an Ionic project on macOs and I keep getting this error:

FAILURE: Build failed with an exception.

* Where:
Script '/Users/[PROJECT PATH]/platforms/android/CordovaLib/cordova.gradle' line: 64

* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Install the Android build tools version 19.1.0 or higher.

This is method failing:

String doFindLatestInstalledBuildTools(String minBuildToolsVersion) {
    def availableBuildToolsVersions
    try {
        availableBuildToolsVersions = getAvailableBuildTools()
    } catch (e) {
        println "An exception occurred while trying to find the Android build tools."
        throw e
    }
    if (availableBuildToolsVersions.length > 0) {
        def highestBuildToolsVersion = availableBuildToolsVersions[0]
        if (compareVersions(highestBuildToolsVersion, minBuildToolsVersion) < 0) {
            throw new RuntimeException(
                "No usable Android build tools found. Highest installed version is " +
                highestBuildToolsVersion + "; minimum version required is " +
                minBuildToolsVersion + ".")
        }
        highestBuildToolsVersion
    } else {
        throw new RuntimeException(
            "No installed build tools found. Install the Android build tools version " +
            minBuildToolsVersion + " or higher.")
    }
}

I've seen all the answers here:

https://stackoverflow.com/questions/31190355/ionic-build-android-error-no-installed-build-tools-found-please-install-the

My ./bash_profile is:

# Create a JAVA_HOME variable, determined dynamically
  export JAVA_HOME=~/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
  
# Add that to the global PATH variable
  export PATH=${JAVA_HOME}/bin:$PATH
  
# Set Android_HOME
  export ANDROID_SDK_ROOT=~/Users/harjindersandhu/Library/Android/sdk/
  
# Add the Android SDK to the ANDROID_HOME variable
 export PATH=${PATH}:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools
  
#Set GRADLE_HOME
  export GRADLE_HOME=/usr/local/Cellar/gradle/7.3.3
  export PATH=$PATH:$GRADLE_HOME/bin

After every edit I run the command source "source ~/.bash_profile".

On Android Studio in build tools I got: Is this correct?

I also ran these commands in my Android bin folder:

./sdkmanager "platform-tools" "platforms;android-26"
./sdkmanager "build-tools;27.0.3"

These are info from "ionic info":

Ionic:

Ionic CLI: 5.4.16 (/usr/local/lib/node_modules/ionic)
Ionic Framework: @ionic/angular 5.9.3
@angular-devkit/build-angular : 0.1102.18
@angular-devkit/schematics: 11.2.18
@angular/cli : 11.2.18
@ionic/angular-toolkit: 3.1.1 Cordova:

Cordova CLI: 11.0.0
Cordova Platforms : android 6.3.0
Cordova Plugins: cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 8 other plugins)

Utility: cordova-res : not installed
native-run : 1.5.0 System:

ios-sim : 8.0.2
NodeJS : v16.13.2 (/usr/local/bin/node) npm : 8.1.2 OS : macOS Monterey
Xcode: Xcode 13.1 Build version 13A1030d

I've tried installing(ionic cordova platform add android@{versionnumber} different versions but still having same errors.

Can anyone please tell me what I'm doing wrong, I'm stuck and not able to solve this issue. My project is running on ionic serve, I'd just want to use the command "ionic cordova run android".

Thanks a lot

this.jind
  • 319
  • 1
  • 4
  • 14

0 Answers0