Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 1. Setting Up your Environment > Time for action – installing Android S...

Time for action – installing Android SDK and NDK on Windows

  1. Open your Web browser and go to This web page lists all available SDKs, one for each platform.

  2. Download Android SDK for Windows, packaged as an Exe installer.

  3. Then, go to and download the Android NDK (not SDK!) for Windows, packaged as a ZIP archive this time.

  4. Execute Android SDK installer. Select an appropriate installation location (for example, C:\Android\android-sdk), knowing that Android SDK and NDK together can take more than 3 GB of disk space (currently!) with all official API versions installed. As a precaution, avoid leaving any space in the target installation path.

  5. Follow the installation wizard until the end. Check the Start SDK Manager:

  6. The Android SDK and AVD Manager is launched. The Package installation window appears automatically.

  7. Check the Accept All option and click on Install to start the installation of Android components:

  8. After a few minutes, all packages get downloaded and a message asking to restart ADB service (the Android Debug Bridge) appears. Validate by clicking on Yes.

  9. Close the application.

  10. Now, unzip Android NDK archive into its final location (for example, C:\Android\android-ndk). Again, avoid leaving any space in the installation path (or some problems could be encountered with Make).

    To easily access Android utilities from the command line, let’s define the environment variables:

  11. Open the Environment Variables system window, as we did in the previous part. Inside the System variables list, insert the ANDROID_SDK and ANDROID_NDK variables with the corresponding directories as values.

  12. Append %ANDROID_SDK%\tools, %ANDROID_SDK%\platform-tools and %ANDROID_NDK%, all separated by a semicolon, to your PATH.

  13. All the Windows environment variables should be imported automatically by Cygwin when launched. Let’s verify this by opening a Cygwin terminal and checking whether NDK is available:

    $ ndk-build –-version

  14. Now, check the Ant version to make sure it is properly working on Cygwin:

    $ ant -version

    The first time Cygwin should emit a surprising warning: paths are in MS-DOS style and not POSIX. Indeed, Cygwin paths are emulated and should look similar to /cygdrive/<Drive letter>/<Path to your directory with forward slashes>. For example, if Ant is installed in c:\ant, then the path should be indicated as /cygdrive/c/ant.

  15. Let’s fix this. Go to your Cygwin directory. There, you should find a directory named home/<your user name> containing a .bash_profile. Open it in edition.

  16. At the end of the script, translate the Windows environment variables into Cygwin variables with the cygpath utility. PATH does not need to be translated as this essential variable is processed automatically by Cygwin. Make sure to use the prime character (`) (to execute a command inside another), which has a different meaning than the apostrophe (‘) (to define a variable) with Bash. An example .bash_profile is provided with this book:

    export ANT_HOME=`cygpath –u "$ANT_HOME"`
    export JAVA_HOME=`cygpath –u "$JAVA_HOME"`
    export ANDROID_SDK=`cygpath –u "$ANDROID_SDK"`
    export ANDROID_NDK=`cygpath –u "$ANDROID_NDK"`
  17. Reopen a Cygwin window and check the Ant version again. No warning is issued this time:

    $ ant -version

What just happened?

We have downloaded and deployed both Android SDK and NDK and made them available through command line using environment variables.


You are currently reading a PREVIEW of this book.


Get instant access to over $1 million worth of books and videos.


Start a Free Trial

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint