SDK for Android

SDK for Android
Let’s dispel the myth that mobile development is ˝EASY˝, beginner-friendly, and suited for ˝web developers˝. This is marketing crap and media hype. Mobile development is VERY difficult – it’s much more difficult and more complicated than web or server app development. If you have experience in web or server app development, this experience will NOT help you with mobile. Sample code from open source projects, tutorials, and books will not come close to getting you ready for the minefield that is mobile development, deployment and testing so... The point of this Wiki is not to teach you how to use SDK. After reading it through you`ll hopefully understand what SDK is and how to install it on your computer.




WHAT DOES ANDROID SDK MEAN?
A software development kit that enables developers to create applications for the Android platform. The Android SDK includes the following:

  • Required libraries
  • Debugger
  • An emulator
  • Relevant documentation for the Android application program interfaces (APIs)
  • Sample source code
  • Tutorials for the Android OS
Every time Google releases a new version of Android, a corresponding SDK is also released. To be able to write programs with the latest features, developers must download and install each version’s SDK for the particular phone.

The development platforms that are compatible with SDK include operating systems like Windows (XP or later), Linux (any recent Linux distribution) and Mac OS X (10.4.9 or later). The components of Android SDK can be downloaded separately. Third party add-ons are also available for download.

Although the SDK can be used to write Android programs in the command prompt, the most common method is by using an integrated development environment (IDE). The recommended IDE is Eclipse with the Android Development Tools (ADT) plug-in. However, other IDEs, such as NetBeans or IntelliJ, will also work. Most of these IDEs provide a graphical interface enabling developers to perform development tasks faster. Since Android applications are written in Java code, a user should have the Java Development Kit (JDK) installed.


There are several different packages available for the Android SDK. The table below describes most of the available packages:


sdk.PNG

The above table is not comprehensive and you can add new sites to download additional packages from third-parties. By default, Available Packages displays packages available from the Android Repository and Third party Add-ons. You can add other sites that host their own Android SDK add-ons, then download the SDK add-ons from those sites.

For example, a mobile carrier or device manufacturer might offer additional API libraries that are supported by their own Android-powered devices. In order to develop using their libraries, you must install their Android SDK add-on, if it's not already available under Third party Add-ons.



GENERAL INSTRUCTIONS


PREPARE YOUR COMPUTER

1. Make sure your computer meets the system requirements
2. Make sure you have installed the Java Development Kit
*(Optional) Install Eclipse IDE - Eclipse classic is recommended

Download the SDK Starter Package

The SDK starter package is not a full development environment - it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).

Download the latest SDK Starter Package

*(Optional) If you use Eclipse, download the ADT Plug-in

NOTE: if you want to save some time, the latest version of the Eclipse plug-in will automatically download the SDK starter package as well as the Android SDK and install it to Eclipse.

Download platforms and other components

1. Eclipse: Select Window » Android SDK and AVD Manager
2. Windows: Double-click the SDK Manager.exe file at the root of the Android SDK directory
3. Mac or Linux: Open a terminal and navigate to the /tools directory in the Android SDK, then execute ./android



OS SPECIFIC INSTRUCTIONS


Linux (general)

adb Environmental Variables

1. Open ~/.bashrc and add the following to the very bottom
2. export PATH=${PATH}:<sdk>/tools:<sdk>/platform-tools
3. Change <sdk> to the actual path. ie /home/user/android-sdk-linux

Close and re-open your terminal to refresh variables.


Mac OS X

+ Installing the Android SDK

1. Download the latest version of the Android SDK

2. Unzip it and move it where needed unzip Downloads/android-sdk_r18-macosx.zip -d ~/bin

3. Open Terminal.app (in /Applications/Utilities)

4. (create or) Edit ~/.profile and append export PATH=~/bin/android-sdk-macosx/platform-tools:~/bin/android-sdk-macosx/platforms:~/bin/android- sdk-macosx/tools:$PATH

now

1. Load new .profile: source .profile


2. Run Android SDK Manager: android


3. Install Components


+ Installing Eclipse

1. Download the latest version of Eclipse (Classic or Java Developers are probably best)

2. Open Terminal.app (in /Applications/Utilities)

3. Unzip it and move it where needed

tar -zxvf Downloads/Eclipse-java-helios-SR1-macosx-cocoa-x86_64.tar.gz

*Optional: Add to PATH. Edit ~/.profile and append export PATH=[Eclipse folder]:$PATH then reload source .profile

4. Open Eclipse.

5. Go to Help » Install New Software.

6. Click Add
- Name: Google ADT
- Location: https://dl-ssl.google.com/android/eclipse/

7. Install pieces that you want.

8. When ADT installation is complete, the latest version of Eclipse and ADT will ask you to install or set location for android SDK. Set the location where you installed the SDK. Click OK.

9. If you did not see a prompt to install or choose location for ADT, open Preferences, go to Android. Set your SDK location. Click OK.


Windows

1. Download the latest Android SDK (preferably the zip file not the exe)
2. Unzip the package to the root of C:\.
NOTE: This will output a folder called "android-sdk-windows"
3. Open up the android-sdk-windows folder and launch the SDK Manager.
4. When you launch the SDK Manager for the first time it will ask for which packages to install. The only package we are concerned with at this time is "Android SDK Tools, revision 20", "Android SDK Platform-tools, revision 12" & "Google USB Driver package, revision 6". You can reject all the others if you are not interested in them.
5. Once that's finished installing, you can close the SDK Manager.
6. Go to the Control Panel, and select the System Properties (Windows XP) or System (Windows Vista/7).
7. Select the Advanced settings;
- Windows XP: Click on the Advanced tab.
- Windows Vista/7: Click on Advanced system settings on the left.
8. Click on Environment Variables.
9. Under the "System variable" section, you will look for "Path". Double-click on it.
10. In the "Variable values" section, add at the very end the location of the tools & package-tools folder, with a semicolon separating these two paths from the rest, e.g. %SystemRoot%;C:\android-sdk-windows\platform-tools;C:\android-sdk-windows\tools.
11. On the device, ensure that USB Debugging in enabled (Settings » Applications » Development).
12. Plug the device into the computer via USB cable. The computer will attempt to install the drivers automatically.
13. On success, open the command prompt on the computer, and type in the following command to sure everything is setup properly: adb devices
NOTE: You may to need to logout and/or reboot your computer for this to work. Otherwise Windows will say the command is not recognized


If it lists any devices, everything is fine and you are finished. If not, the drivers may not be installed correctly, so continue

1. Open the Device Manager
- Right-click on My Computer (Windows XP) or Computer (Windows Vista/7).
- Click on Manage.
- Click on Device Manager on the left.
You will probably see Unknown Device with ADB listed under it with a yellow exclamation mark
- Right-click on ADB.
- Click on "Update Driver Software".
- Click on "Browse my computer for driver software".
- Click on "Let me pick from a list of device drivers on my computer".
- Click on "Have Disk".
- Click on "Browse".
- Navigate to "C:\android-sdk-windows\google-usb_driver" and select "android_winusb.inf"
- Click on "Android ADB Interface".

NOTE: You will get an Update Driver Warning, click on "Yes"

2. Once finished installing the driver, open the command prompt on the computer, and type in the following command to sure everything is setup properly: adb devices

If it lists any devices, everything is fine and you are finished. If not, you may have further issues and will have to do further research on your own.


by arawn
Aug 7, 2012