Cordova build android - error: android sdk not found (but installed and ANDROID_HOME is correctly installed on OS X)

On a new system, I have installed:

Then I launched Android Studio and installed the default SDK as well as the SDK for versions 23, 22, 14, 11 and 8 (a selection of targets that I have used for previous projects). I downloaded Platform Tools 25.0.4 and SDK Tools 26.0.1.

Then install:

  • NodeJS
  • PhoneGap

I set up my environment:

export ANDROID_HOME=~/Library/Android/sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/
export PATH=$PATH:$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

      

I pulled my existing Cordova project from my local git repository and ran:

phonegap platform add android@5.1.1

      

(because I have a plugin from https://github.com/Wizcorp/phonegap-facebook-plugin that has an issue that it cannot build with the current version of the Android Platform Specification, this command is suggested as a workaround )

phonegap build android

      

This gave an error:

[phonegap] executing 'cordova build android ' ...
Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.

      

Any suggestions what could be wrong?

+3


source to share


1 answer


The latest version of the SDK tools removed support for a number of features that the Cordova tools relied on, so it no longer works correctly. To use the latest Android SDK, you need to use version 6.2.0 of the Android platform module. It's not officially released yet, but is in the NPM repository, so it can be used like this:

cordova platform add android@6.2.0

      

This obviously doesn't work with the module phonegap-facebook-plugin

. Fortunately, there is a fork that works with this latest version:



cordova plugin rm phonegap-facebook-plugin
cordova plugin add cordova-plugin-facebook4 --variable APP_ID=appid --variable APP_NAME="app name here"

      

I also had to hunt down phonegap-facebook-plugin links in my config.xml file because it kept returning otherwise.

0


source







All Articles