To be able to emulate android in our pc we need the SDK, the best way to install it is with the Android Studio. Also in this document you will learn how to use your android device to see the application.

1 Installation Android Studio and SDK

To install Android Studio on your Mac, proceed as follows:

  1. Launch the Android Studio DMG file.
  2. Drag and drop Android Studio into the Applications folder, then launch Android Studio

Download:Android Studio


Now with Android Studio we can prceed to install the SDK:

  1. Open Android Studio
  2. Under the window you find the Configure> button, inside we click on SDK Manager.
  3. Install the android version that you want to use:
  4. Then install the SDK Tools, in this case we select all:

2 Add Virtual Device

To run your application you must first add a virtual device. We can select the type of device we want to use and the Android version.

  1. First click on AVD Manager:
  2. Then create Virtual Device:
  3. Select the device that you want to use:
  4. If you select a device that is compatible with Google Play select or download a version.
  5. Verify the configuration:
  6. And finally you can run the emulator:

3 Physical Android Phone

Poder utilizar nuestro propio dispositivo android hace que el ordenador no tenga que utilizar tantos recursos. Para poder utilizarlo solo hace falta un cable USB y configurar algunas opciones.

  1. First of all activates the developer options:
    1. Open the Settings app.
    2. (Only on Android 8.0 or higher) Select System.
    3. Scroll to the bottom and select About phone.
    4. Scroll to the bottom and tap Build number 7 times.
    5. Return to the previous screen to find Developer options near the bottom.
  2. Activate this options:

4 Create BashProfile for ANDROID_HOME

Bash_profile is a configuration file for bash shell. When bash is invoked as an interactive login shell it first reads and executes commands from ~/.bash_profile. ... This file can be used to export variables in shell.

In this case when we execute the command:

Copy
$ cordova build

We got this error:


  1. With superuser go to the folder /var/root/:
  2. Since we don't have this file, we will create it :
  3. Now reload the bash_profile:
    Copy
    $ source ~/.bash_profile

4.1 How to find the SDK folder

Where the Android-SDK is installed depends on how you installed it.

  • If you downloaded the SDK through their website and then dragged/dropped the Application to your Applications folder, it's most likely here:
    /Applications/ADT/sdk
  • If you installed the SDK using Homebrew (brew cask install android-sdk), then it's located here:
    /usr/local/Caskroom/android-sdk/{YOUR_SDK_VERSION_NUMBER}
  • If the SDK was installed automatically as part of Android Studio then it's located here:
    /Users/{YOUR_USER_NAME}/Library/Android/sdk