[SOLVE] Problem with build android (Mac)


#1

Hello! I have an issue when I execute "ionic Cordova build android"
I have the next error:

:heavy_multiplication_x: Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=/usr/local/share/android-sdk
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
    Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
    Looked here: /usr/local/share/android-sdk/tools/templates/gradle/wrapper

I have downloaded the Gradle Binary Only Distribution from https://gradle.org/gradle-download/
I copy the folder in my Development directory and I have a new variable “GRADLE_HOME” in my bash_profile, so my file bash_profile is like this:

export ANDROID_HOME=/usr/local/share/android-sdk
export PATH=${PATH}:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
export JAVA_HOME=/usr/libexec/java_home
export GRADLE_HOME=~/Development/gradle-3.5/bin

Somebody know how can I fix the error?
Thanks in advance!!

  • I have fixed the problem installing SDK with Android studio, not executing “brew cask install android-sdk”.

#2

Check this thread:


#3

Thanks for reply! and yes, I try many options… but I can’t fix my problem, I don’t know if its for the SDK installation o what. I installing SDK like this:

brew tap caskroom/cask
brew cask install android-sdk
brew cask install android-platform-tools

I don’t know if its the best option… Im new using Mac and Im a little bit lost, on windows work fine.


#4

I was also confused on Mac at first time but then i installed android studio and installed sdk from android studio’s sdk manager. After these steps my application started working fine.


#5

OK, then… I will try installing android studio too. Thank you very much!!


#6

Installing sdk from android studio’s sdk manager all work fine :slight_smile: thank you very much!