Huwebes, Enero 24, 2013

Android: Geting Started on setups



1. Getting Started on setups

1.   Download the Android SDK from android.developer.com. Choose your platform. In my case, it was a zipped file
2.   Place the unzipped file somewhere in your directories. It is best not to put in a directory that contains white space. I placed mine inside /Users/myname/prgtools/android-sdk (this is your ANDROID-HOME)
3.   Go to your ANDROID-HOME/tools, launch the android executable. This will launch the Android SDK Manager. The android SDK needs an internet connection. It connects to the android.developer.com website and checks which SDK levels are installed in your machine. Naturally, if you have installed the SDK, there won't be much. Choose the API levels that you would like to install in your machine.
Each version or platform of Android (Froyo, Gingerbread etc) is a numbered API level. If you want to install the Froyo SDK, for example, then check the box next to API level 8 (Android version 2.2). If you have really fast internet connection and you are not sure which API to check, check them all---be warned though, you will wait for a long time for it to finish.
4.   Include the android tools and platform tools in your shell's path. You will need it if you want to work with android using the command line. The two folders of interest are ANDROID-HOME/tools and ANDROID-HOME/platform-tools

In OSX, you can add the following entries in th ~/.bash_profile
export ANDROID_HOME=/path/to/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:.
export PATH=$PATH:$ANDROID_HOME/platform-tools:.
In Linux, add the following lines to ~/.bashrc, if you are using bash
export ANDROID_HOME=/path/to/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools:.
export PATH=$PATH:$ANDROID_HOME/platform-tools:.
Close the terminal, then launch it again in order to reflect the changes we made to the PATH variable.
In Windows, there are two ways to set the PATH
The first method is via the command line (cmd.exe).

SET ANDROID_HOME=c:\>path\where\you\installed\android\
SET PATH=%PATH%;%ANDROID_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;.
You will need to run those commands though, each time you will open a new CMD.exe. Those settings are not remembered by the shell.
If you want to permanently set these PATHS, you need to do it in the System Properties dialog box. First, open Control Panel, go to System Properties, then Advanced System Settings then click the button Environment variables

If you have local admin rights on the machine, click the New button on System variables section. On the variable name, type ANDROID_HOME. On the value textbox, type the full path where you installed the Android SDK. Close the dialog box. Next, scroll down the values on System variables, try to find PATH, then click the Edit button. Go to the last character of the existing entry, then add%ANDROID_HOME%;%ANDROID_HOME%-tools;%ANDROID_HOME%;.


I've been using this SDK manager for quite sometime now, that is why a lot of tick boxes says "installed". During your first run of this SDK manager, they will mostly be empty. You need to download quite a bit before you can get down and dirty in trying to write your first few apps.
The top level folders (tick boxes) are numbers which correspond to the Android versions. If you want to develop for Ice Cream Sandwich, Honeycomb, Gingerbread and Froyo, you will need API levels 16, 15, 14, 12, 10 and and 8 respectively, so tick them all, start the download---and get some coffee, it will take some time depending on the speed of your internet connection.

Walang komento:

Mag-post ng isang Komento