I have looked EVERYWHERE for the solution to this.
Ionic Cordova Build Android No installed build tools found did not work
cordova build android failed with exception was a ridiculous non-answer. OF COURSE Android Studio is installed!!!
Android studio- "SDK tools directory is missing" I did this. The $ANDROID_SDK_ROOT/tools folder now exists, but that didn't solve my problem.
I tried the advice given here: Ionic Cordova Build Android No installed build tools found and all I get when I run sdkmanager packages "build-tools;30.0.3"
is "failed to find package 'packages'" from the SDK Manager.
I looked here: Android SDK Manager does not exist and installed ALL the stuff they said to install -- including the obsolete packages. And still no luck.
Here's my path:
/opt/homebrew/bin:/Users/lmacneill/.sdkman/candidates/java/current/bin:/Users/lmacneill/.sdkman/candidates/gradle/current/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/lmacneill/CordovaProjects/gamapp/node_modules/.bin:/Users/lmacneill/Library/Android/sdk/tools:/Users/lmacneill/Library/Android/sdk/build-tools:/Users/lmacneill/Library/Android/sdk/platform-tools
Here's my Android Studio SDK Platforms screen: https://i.sstatic.net/2e5YI.png
And here's my Android Studio SDK Tools screen: https://i.sstatic.net/btLIR.png
(Unrelated to this post, but very weird -- it told me I needed 10 reputation to post images, yet I have 661 reputation. Why did it do that? Hence the link to my images instead of the actual images.)
SO WHY CAN THE TOOLS NOT BE FOUND?!!!!!!. I've done EVERYTHING that EVERYONE has suggested, and STILL IT DOESN'T WORK!!!!
This is ridiculous!!!! Surely someone must know the answer?
Well... I FINALLY figured it out...
In the $ANDROID_SDK_ROOT/build-tools
folder, there was a 33.0.2
folder. So in my .zshrc file, instead of adding $ANDROID_SDK_ROOT/build-tools
to the path, I needed to add $ANDROID_SDK_ROOT/build-tools/33.0.2
to the path.
Then cordova build android
FINALLY worked!!!
BTW, I figured this out when I finally got sdkmanager to install the build-tools;30.0.3 -- you have to use sdkmanager "build-tools;30.0.3"
command, NOT the sdkmanager packages "build-tools;30.0.3"
command. Maybe the command with the 'packages' bit worked for an older version of sdkmanager? But it definitely doesn't work now. Anyway, once I saw that it had created a new folder in $ANDROID_SDK_ROOT/build-tools, I finally realized that exporting only $ANDROID_SDK_ROOT/build-tools in the path wasn't enough. You have to include the version folder in there as well.
ANDROID!!! Y'ALL SHOULD MAKE THIS EASIER!!!! INSTALLING ANDROID STUDIO SHOULD DO ALL OF THIS STUFF AUTOMATICALLY!!!!!