简体   繁体   中英

MAC - Cordova error after installing Android Studio

On Mac os - Cordova stoped working after installing Android Studio (4.4.1)

NOTE: it was working previous to the installation

With the following errors:

The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.

And (After the first one was solved)

You may not have the required environment or OS to build this project

The android PATH changes and was not updated by the cordova, I had to do:

  1. update PATH env var

    touch ~/.bash_profile; open ~/.bash_profile

add the lines:

export ANDROID_SDK="/Users/%USR%/Library/Android/sdk"
export ANDROID_HOME="$ANDROID_SDK"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK/platform-tools"
export PATH="${PATH}:$ANDROID_HOME/tools:$ANDROID_PLATFORM_TOOLS"
  1. update local.properties under platforms/andorid and platforms/android/CordovaLib (line 10) to

    sdk.dir=/Users/%USR%/Library/Android/sdk

where %USR% is your user name

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