Pages

Monday, May 19, 2014

Setting Up the Development Environment Android SDK / INSTALLATION OF ANDROID SDK


Supported development platforms

  • The Vuforia SDK supports Android OS 2.3 and above.
  • The recommended development environment is Microsoft Windows 7 32/64-bit or Windows XP.
  • The components to build the actual code (JDK, Eclipse+ADT and gcc) are available across multiple platforms. While building on Linux Ubuntu and Mac OS X environments is possible, we are unable to support those platforms with detailed documentation. However, we have included hints and notes to platform-specific issues that will help you set up your development environment on Linux Ubuntu 10.10 or Mac OS X 10.6 (Snow Leopard). This setup guide has been written for the Win7 32/64-bit platform with special notes for other operating systems.
NOTE: If you have already set up the Android SDK and NDK, go directly to Step 2: Installing the Vuforia SDK.

Set up the Android development environment

The Vuforia SDK requires the Android SDK and the NDK. The Android NDK is an extension of the Android SDK that lets Android developers build performance-critical parts of their applications in native code. The SDK and NDK communicate over the Java Native Interface (JNI).
To set up the development environment, install these components in the following order, using the latest versions of the tools with the Vuforia SDK:
  • JDK (Java SE)
  • Android ADT (Android Developer Tools) Bundle, which includes:
    • Eclipse IDE with the ADT plugin
    • Android SDK Tools
    • Android Platform Tools
    • Latest Android SDK platform
  • Cygwin environment
  • Android NDK

JDK

  1. Dowload the Java SE Development Kit (JDK) from this site: http://www.oracle.com/technetwork/java/javase/downloads/
  2. Click  Download from the JDK section of the 'Java Platform, Standard Edition' table.
  3. Install the JDK environment with default settings.
Detailed installation instructions and system requirements can be found athttp://www.oracle.com/technetwork/java/javase/index-137561.html
MAC: The JDK is already integrated into the Mac OS X operation system.

Android ADT Bundle

The ADT Bundle includes the following components:
  • Eclipse IDE + ADT plugin
  • Android SDK Tools
  • Android Platform-tools
  • The latest Android platform
To install the ADT Bundle:
  1. Download the latest version from:
  1. Unpack the downloaded ZIP package, which should reveal the following content:
    1. ‘/eclipse’ folder, containing the Eclipse IDE (with the ADT plugin)
    2. ‘/sdk’ folder, containing the Android SDK and the SDK/platform tools
    3. ‘SDK_Manager.exe’
  2. Copy the folders and files above into your Android development directory, such as.:
                        C:\Development\Android\
Throughout the Getting Started guide we refer to the base directory as:
                        <DEVELOPMENT_ROOT> = C:\Development\Android
  1. Once you have completed the steps above, you can open the Eclipse IDE by running Eclipse.exe which is located in the ‘/eclipse’ folder.
MAC: For MAC OS X, we recommend using the 32-bit version of the ADT Bundle.
Linux: Eclipse is not always able to determine the location of the JVM, despite being in the path. To fix this, insert into <path-to-eclipse-dir>/eclipse.ini the following line at the top:
    -vm <path-to-JVM>
 For example:
    -vm /user/bin/java

SDK Manager

The SDK Manager allows you to install or update the latest Android platform tools. When downloading and installing the ADT Bundle, the latest tools should be already availaqble with the bundle; however, you may also want to periodically check for available updated versions of the SDK/platform tools.
  1. In Eclipse, select the menu Window->Android SDK Manager. If the Android SDK location was not set up correctly within Eclipse, go to Windows-> Preferences->Android,  and set the SDK location field to the root of your SDK install directory.
  2. In the Android SDK manager window, sort by API level, click Deselect All and check the following boxes:
 From Tools:
  • Android SDK Platform-tools
  From Android 4.4 (API 19):
  • Documentation for Android SDK
From Android 2.3.3 (API 10):
  • SDK Platform
  • Samples for SDK (optional)
From Extras:
  • Google USB Driver package (only required on Windows)
Android SDK component selection
  1. To install the selected options, click Install 5 packages... and accept all licenses on the next window. Use Accept All as a shortcut and click Install.
Android component license acceptance
  1. Add the platform-tools\ directory to your Windows path:  ;C:\Development\Android\android-sdk-windows\platform-tools\
    NOTE: The last "\" at the end of the Path variable has to be included.
    MAC: Update the PATH variable to point to the Android SDK Platform-tools directory in the/etc/rc.common file or ~/.bash_profile:
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices:/Developer/usr/bin:~/Development/Android/android-sdk-macosx/tools:~/Development/Android/android-sdk-macosx/platform-tools:export PATH
    LINUX: Update your PATH to point to the Android SDK Platform-tools directory. If you use bash shell, add the following to ~/.bashrc :
    export PATH=/opt/android-sdk-linux/tools/:/opt/android-sdk-linux/platform-tools/:$PATH
    The Eclipse environment is now ready for Android development. 

Cygwin environment

LINUX: This section is not relevant for Linux users who have GNU make installed and in their path.
MAC: This section is not relevant for Mac users who have Apple Developer Tools (XCode) installed. Install XCode if necessary from http://developer.apple.com/xcode/.
Since version 2.8, the Vuforia SDK for the Android platform includes both a Java API and a C++ API. The Java API enables the full suite of Vuforia features and functionalities and allows developers to build Android applications without having to write native C++ code.
The C++ API is meant to be used by developers with very advanced / specific requirements, such as the ability to integrate C++-based third party libraries or custom C++ software components. When this is not required, it is generally recommended to use the Java API.
If you expect to need the C++ native API, you will need a C++ GNU compiler, as explained in the following paragraph; otherwise, for pure Java based development, you can skip this section.
A GNU compiler is required to compile dynamic applications as shared libraries for the Android NDK. Android make files are designed to run with gcc4. On Windows, a convenient way to have the complete environment prepared for this, is to install Cygwin.
Cygwin uses an installer helper to manage the installation process.
  1. Go to http://www.cygwin.com, download and run the installer (setup.exe), and select "Install from the Internet!" when prompted at "Choose A Download Source" in the installer. We recommend not changing the Root Directory in the next window, and leaving it at "C:\cygwin." The "Local Package Directory" holds the downloaded packages. You may want to keep them with the downloaded Setup.exe file in the same directory to have a Cygwin installer directory. Choose a download site with a known fast connection near you.
When the package information is downloaded you will see a hierarchical browser to select packages.
  1. Select the following package from the hierarchy for download: All -> Devel -> "make: The GNU version of the 'make' utility"
  2. Select the word skip to change it to the actual version number, which is currently 3.82-90.
  3. Finish the installation by clicking Next.
Your Cygwin environment is fully set up to work with the QCAR SDK. If you have other similar environments installed, make sure to set your Windows path variable to point to "C:\cygwin\bin" so that bash uses this version of GNU's make.exe.

Android NDK

If you need to use the C++ API of the Vuforia SDK, you will also need to install the Android NDK which enabled native C++ programming on Android. If you plan to only use the Java API, you can skip this section.
The Android NDK is an extension of the Android SDK that lets Android developers build performance-critical parts of their applications in native code.
  1. Download the NDK package from http://developer.android.com/sdk/ndk/index.html
  2. Unzip the archive, and copy the contents into a directory. To be consistent with our previous setup, we recommend putting the contents in "C:\Development\Android\android-ndk-rxy\." Thus, Android SDK and Android NDK share the same parent directory. Later, we will add the Vuforia SDK and your project files.
NDK requires the above directory to be added to the Windows path.
  1. Right-click My Computer on the desktop and select Properties.
  2. On the Advanced tab, select Environment Variables and look for the Variable “Path” in the System variables window.
  3. After pressing Edit, scroll to the end of “Variable value:” and add the full path to the directory to the end of the path, separated by a semicolon from the previous path. In the above example, you would add:
;C:\Development\Android\android-ndk-rxy\
NOTE: Path has a semicolon at the beginning. Do not use pathnames with spaces. Alternatively, you can set a User variable with the name Path, but this is valid only for the current user. The last "\" at the end of the Path variable has to be included.
  1. To test your installation, compile any of the NDK sample applications. Using a Cygwin bash shell, navigate to the root directory of any demo application (e.g., for the 'san-angeles' sample app without the installation path above):
cd /cygdrive/c/Development/Android/android-ndk-rxy/samples/san-angeles
ndk-build
The compiler should produce a dynamically linked library libsanangeles.so and write it to/libs/armeabi within the application directory. NDK includes support for different architectures so you might find different subdirectories in /libs.
Now your development environment is ready to host Vuforia SDK-related content.
MAC: Update the PATH variable to point to the Android NDK directory in the /etc/rc.common file or~/.bash_profile:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices:/Developer/usr/bin:~/Development/Android/android-sdk-macosx/tools:~/Development/Android/android-sdk-macosx/platform-tools:~/Development/Android/android-ndk-rxy:export PATH
LINUX:  Update your PATH to point to the Android NDK Platform directory. If you use bash shell, add the following to the ~/.bashrc file:
export PATH=~/bin:/opt/android-sdk-linux_x86/tools/:/opt/android-ndk-rxy:$PATH
Friends, If you like this post, please share with your friends on Facebook and Google+ and recommend us on Google using the g+1 button on the top right hand corner.

No comments:

Post a Comment