How install Android Platform


#1

Hi,
I try to add a platform: ionic build android
It doesn’t work?

firstIonicApp  ionic build android
 Using this version of Cordova with older version of cordova-android is being deprecated. Consider upgrading to cordova-android@5.0.0 or newer.
Error: The provided path "/Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp/platforms/android" is not an Android project.
 ⚙ ✝  /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp  ionic platforms add android
Updated the hooks directory to have execute permissions
Downloading Default Ionic Resources
Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
[========]  100%  0.0s
Done adding default Ionic resources
Adding icons for platform: android
Adding android project...
Creating Cordova project for the Android platform:
	Path: platforms/android
	Package: com.ionicframework.firstionicapp173289
	Name: firstIonicApp
	Activity: MainActivity
	Android target: android-23
Android project created with cordova-android@5.1.1
Installing "cordova-plugin-console" for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-splashscreen" for android
Installing "cordova-plugin-statusbar" for android
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing "ionic-plugin-keyboard" for android
Running command: /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp/hooks/after_prepare/010_add_platform_class.js /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp
add to body class: platform-android
Saving platform to package.json file
 ⚙ ✝  /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIoni

Thanks


#2

What results do you see when you execute this command?

ionic platforms

You should see android as an installed platform. Otherwise, run this:

ionic platform add android


#3

I’m run a Mac osx.

The platform are installed
ionic platforms Updated the hooks directory to have execute permissions Installed platforms: android 5.1.1 ios 3.8.0 Available platforms: amazon-fireos ~3.6.3 (deprecated) blackberry10 ~3.8.0 browser ~4.1.0 firefoxos ~3.6.3 osx ~4.0.1 webos ~3.7.0

but when I tried to build my project:

    ionic build android
    Running command: /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp/hooks/after_prepare/010_add_platform_class.js /Applications/MAMP/htdocs/labs/ionic/ionic-pluralsight/firstIonicApp
    add to body class: platform-android
    Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
    Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

Which strategy to set up my path and add the right link for Android in my home config file?
here my path:

export PATH="/Users/xavi/bin:$MAMP_PHP:$PATH:/usr/local/Cellar:/usr/local/bin:~/Library:/usr/local/lib:/Users/xavi/bash-wordpress:/Users/xavi/.npm/bin:/usr/sbin:/bin:/Users/xavi/arcanist/bin:/usr/bin:/usr/local/bin:/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/bin/composer"


#4

Check if you have configured your path environment for android.

  1. On your mac terminal, type in echo $ANDROID_HOME. It should output something similar below,
    /Users/youraccount/{PathToYourAndroidSDK}/android-sdk-macosx

  2. The same directory should also show when you type in echo $PATH.

If no android home entry found then add it via terminal below.
export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools


#5

I reinstalled every things and is work now,
thanks all, for the advice.