Saturday, September 10, 2011

Android Programming - Setting Up Your Environment

This is my first article of Android Programming Series in my blog. I'll share you how to set up an environment to begin programming in Android. Actually it was easy and the Android Developer site have a full article about this too, but maybe you'll want to read mine, I'll include with several troubleshooting I've found when I first time trying to install this SDK.

Android application made using the Android SDK (Standard Development Kit) and it could use also the NDK (Native Development Kit) that allows you to use a language other than Java (C or C + +), of course it usage for advance programming that really need the efficiency and effectiveness of specific code (socket programming, 3D, high-scale data management).

We can use the interface of Eclipse Java version as an IDE (Integrated Development Environment) with the ADT plugin. Actually, we can also use other Java-based IDE like IntelliJ and NetBeans, but I think most easily with Eclipse because ADT has been good enough in doing the integration, on the other IDE you will still need to generate Eclipse project files as a base in the IDE and then do the programming in another IDE after importing. There also needs  Java Runtime Environment and Java Development Kit to be able to run the program.

Eclipse is a multiplatform IDE, you can use a variety of Linux operating system (Ubuntu recommended), Windows (XP, Vista, 7) and MacOSX from version 10.5.8 (x86).

So before it can begin to make the Android program we should prepare: Eclipse, ADT, Android SDK, JRE, JDK and at least one Android platform to make Android Virtual Devices later.

1. Installing JDK and JRE

Please go to the Java download site. Download the JDK and JRE is the latest if it does not exist on your computer. Please adjust your computer operating system. For Linux it can be downloaded from the repository using your favorite repository management software, there is also an open version JDK.



Note : I bet you found no error in this step, Java installation (both JRE and JDK) is simple (just click the installer) and realy straight forward.

2. Installing Android SDK

Downloaded from the Android Developer site http://developer.android.com. There are also provided the installation guide. For Windows as usual just click on the installer and specify the location where we want to put the Android SDK installation folder, please notice the location of this folder, because it will be used for setting the Eclipse as well. In Linux and Mac I think you can do that in simple command too. I use Ubuntu, so I download the .deb version installer, and it works fine, just click, input the administrator password and installed. I placed the SDK in my home folder (Ubuntu) and C:\Program Files in Windows.




Note : it is easy too, just remember the place of Android SDK folder as a mention before, it's a must.

3. Installing Eclipse

Eclipse can be downloaded from its website http://www.eclipse.org . Eclipse does not need to install, just extract your downloaded achive and Eclipse can be used by running eclipse.exe in it. You will be asked about the workspace, select the location where you want to put your Eclipse workspace, in this folder all Eclipse project files will reside. Check the checkbox at the bottom so that you are not continually asked about the workspace when running Eclipse.





Note : Maybe you'll find some error in this step, check that your Eclipse Download is Java IDE version, because Eclipse has separate and various IDE for other language. Check your OS version, remember that maybe your hardware support 64bit OS (you have AMD 64 sticker :p) but ussualy your OS is not 64 bit edition, so you need to download the 32bit version (for SDK and Eclipse). Eclipse will check for JRE installation too, and maybe other dependency, just fill out other dependency to stop the error.

4. Installing ADT

It will be done through Eclipse, open Eclipse, then to Help >> Install New Software >> Add. Enter Name: ADT, location: https://dl-ssl.google.com/android/eclipse . Then click OK. This can be done when your computer is connected directly to the Internet, otherwise you can download the installation file first Android Developer ADT from the site and then install it from Eclipse by selecting the type Archive in the Add dialog box earlier and go to your ADT installation files.

 After this you must connecting your SDK with Eclipse preferences. Go to Window >> Preferences >> Android and add your SDK folder location.




Note : still remember the SDK folder places?Good. Maybe some error will found in this step, try checking internet connection or redownloading the archive.

5. Installing the Android Platform

After successfully installing the ADT you even have the Android SDK and AVD menu in the Window Manager. Also, you can already see there are options to make the Android project in the File >> New >> Other. But you can not make it, because it does not have the build target and AVD (Android Virtual Machine).

Android Platform installation is done from Window >> Android SDK and AVD Manager. It can also be accessed directly from the Android SDK installation file. Go to the Available Packages, and select at least one Android platform. It also can only be done if you are directly connected to the Internet.

If not, there is a little trick to be able to install it offline Android Platform, SDK is another component of the platform can be retrieved from the xml file link http://dl-ssl.google.com/android/repository/repository.xml . It can be seen in the file name such as android-2.2 and can be downloaded from the address http://dl-ssl.google.com/android/repository/ . To install, copy the files downloaded into a new folder called / temp inside the Android SDK installation folder. Then run the AVD, select the appropriate packages that were downloaded earlier and finish. Emulator can be made. Can also be installed in a way more easy to extract the contents of the zip file directly into a folder earlier platforms. Then you can check on the Installed Package AVD Manager, your platform is already installed there.


 Note : problem that can be found is still about the internet connection, for slow connection I recommended the offline install way.

6. Creating AVD

AVD is made ​​from the Window menu >> the Android SDK and AVD Manager >> Virtual Devices >> New. Specify the name of AVD (preferably containing the version, easy to remember), the build target (I think at least 2.1 or 2.2 for now), size SD Card if you want to use, check to be enabled Snapshot, skins use the built-in first, the hardware does not need to be changed first, and can directly click Create AVD.


 Note : Just fill as it must be, minimal error I think, because ADT and Eclipse is pretty good to check our input.

Yeahh...You have done, you have a setting up development environment to start programming in Android. :)

Categories: , , , , , , , , ,

0 komentar:

Copyright © Johannes Dwi Cahyo | Powered by Blogger

Design by Anders Noren | Blogger Theme by NewBloggerThemes.com | BTheme.net      Up ↑