Wednesday, 28 August 2013

Tutorial to Start Android Apps Development for Beginners

If you want to develop your first Android Application using Eclipse IDE (Without using Android Studio) with Windows then follow below steps.

Step 1.

First of all you need to install and set path of JDK 1.x.

How to set Path Environment Variable in Windows:

Windows XP:
Select Start, select Control Panel double click System, and select the Advanced tab.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

Windows Vista:
From the desktop, right click the My Computer icon.
Choose Properties from the context menu.
Click the Advanced tab (Advanced system settings link in Vista).
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

Windows 7:
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.
Also can follow below link to get more knowledge about setting CLASS PATH ENVIRONMENT


Step 2.

Unzip folder of Eclipse IDE then launch Eclipse will get popup window (no need to install it only double click on Eclipse icon) will get popup window and create Android Workspace Directory like below figure, clock on OK button, then workspace created within your specified drive. Now eclipse is running.

 
Step 3.

How to install ADT plug-in manually

After downloading ADT plug-in
Go to Menu Help --> Install New Software
like below figure


Click on “Add” button in the upper right corner of popup window.


Enter Name field with “ADT Plugin” like below figure.
Enter below URL address in the Location field.


Now click on “OK“button and wait until Developer Tools appear (if there is any issue use “http://” instead of “https ://”) check on checkbox of Developer Tools then click on Next button.


Now we will see the components that are installed, again click on “Next” button in below popup window.


Now to read and accept the license agreement click on “Radio” button and click Finish.


The download of components is starting. If comes the Security Warning that the authenticity or validity of the software can’t be established popup window click “OK”.


After finished have to restart Eclipse- click on Restart Now.

 
Step 4.

How to Install and Update SDK Tools Using SDK Manager

After restarting Eclipse if shows the following dialog with warning “ SDK Platform Tools component is missing! Please use the SDK Manager to install it. ” then press “Next” button in below popup window.


Now check “Yes” radio button and click on “Finish” button in below popup window.


Click on “OK” button.


Now go to “SDK Manager” and install it. Go to Window menu in Eclipse click on SDK Manager Label of drop down menu of Window.
In below window you can see that Status column about which API level and component is installed or not. In Name column you can know about API level and Android version which is installed.
In bottom of popup window by checking Radio button and Check button know all the information about installed or not installed components of SDK.
By checking Check box of Name column then click on Install package button and Delete package (Right bottom) of SDK manager popup window can installed or delete Packages of Android support libraries
By checking on Google APIs by Google Inc. Check box you can get facility to develop your Google Map enable apps.
Note: For platforms with versions 4.X choose SDK Platform and ARM EABI v7a System Image (for work with emulator).


After click on Install packages will come new popup window. In the new window by check on Accept All to download it all. Here you can also see the size of components and reject some by checking reject radio button. Now click on Install button it will take approx 20 minutes to install, after installation close the log and SDK manager then restart the Eclipse and your Eclipse environment will ready to develop your first Android App.


How to Install SDK Manually in Eclipse IDE in Android

Suppose after installation of ADT plug-in and Restart of Eclipse IDE following window is now open automatically or accidentally you closed then you have to install you have to install SDK manually.



Install SDK Manually:
Follow below figure.
In Eclipse go to Window-->Preferences (Select and click on)


Now select Android (If ADT plug-in is not installed Android will not show) so first install ADT plug-in before installation of SDK.
Go to SDK Location: label and click on Browse and browse your SDK directory or navigate SDK folder location path copy and paste in this label then select and check checkbox of targeted API level which you want then Apply button will highlight click and press “OK” button. Follow below figure for help.



If below Alert Dialog box is open click “OK” then go to SDK Manager and install that are missing like previous I have explained.


Note: Friends I want to told you if you want to protect from above all settings and issues use Android Studio which encapsulate with all these settings and tools

Step5.

How to Create AVD (Android Virtual Device)

The next step is to create an Android Virtual Device (AVD) to be used for testing your Android applications. An AVD is an emulator instance that enables you to model an actual device. Each AVD consists of a hardware profile, a mapping to a system image as well as emulated storage, such as a secure digital (SD) card.
You can create as many AVDs as you want in order to test your applications with several different configurations. This testing is important to confirm the behavior of your application when it is run on different devices with varying capabilities.
To create AVD you need to go menu Window -->AVD Manager (Select and Click) after open popup window click on “New” button to create AVD.




Enter the name of AVD in “Name” label select “Target” then check Size radio button and enter “SD Card Size” in label of Size. You can check “Snapshot” checkbox to enable snapshot facility through Emulator.
For getting Emulator “Skin” check radio button or give own screen resolution.


To get hardware functionality click on “New” button then will come a popup then press Enter Key of your key board until all the properties of hardware is not added, to facilitate all the hardware functionality of AVD like “Real Device” in Hardware label you will get slider facility to know which type of facility available in AVD.

Hardware options

If you are creating a new AVD, you can specify the following hardware options for the AVD to emulate:

Characteristic                         Description                                  Property

Device ram size         The amount of physical RAM on the device, in megabytes.
                                        Default value is "96".                                 hw.ramSize

Touch-screen support Whether there is a touch screen or not on the device.
                                        Default value is "yes".                                hw.touchScreen

Trackball support        Whether there is a trackball on the device. 
                                       Default value is "yes".                                  hw.trackBall

Keyboard support        Whether the device has a QWERTY keyboard. 
                                       Default value is "yes".                                    hw.keyboard

DPad support                Whether the device has DPad keys. 
                                      Default value is "yes"                                       .hw.dPad

GSM modem support     Whether there is a GSM modem in the device.
                                       Default value is "yes".                                      hw.gsmModem

Camera support       Whether the device has a camera. 
                                      Default value is "no".                                         hw.camera

Maximum horizontal       Default value is "640".           hw.camera.maxHorizontalPixels
 camera pixels

Maximum vertical      Default value is "480".                hw.camera.maxVerticalPixels
camera pixels

GPS support             Whether there is a GPS in the device.                      hw.gps
                                    Default value is "yes".                                                                      

Battery support    Whether the device can run on a battery.
                                   Default value is "yes".                                        hw.battery

Accelerometer Whether
 there is an accelerometer in the device.     Default value is "yes".                                                                                                                                                                   hw.accelerometer
Audio recording support
Whether the device can record audio.        Default value is "yes".     hw.audioInput

Audio playback support                            Default value is "yes".       hw.audioOutput
Whether the device can play audio.

SD Card support                                    Default value is "yes".               hw.sdCard
Whether the device supports insertion/removal of virtual SD Cards.                                                        

Cache partition support                            Default value is "yes".   disk.cachePartition
Whether we use a /cache partition on the device.                                                                                   

Cache partition  size                    Default value is "66MB".  disk.cachePartition.size    
     
Abstracted LCD density               Default value is "160".             hw.lcd.density
Sets the generalized density characteristic used by the AVD's screen.  

                                                                                                   


To enable key up and down and other functionally of keyboard of AVD scroll down below and click on “no” toggle button to get “Yes”. At last click on “Create AVD” button.   
If you want to get Google map enable AVD then you have to select “Google APIs (Google Inc.)” of specific API Level.

How to get AVD Details:

Select any AVD Name and click on "Details" button.



How to launch AVD:
To launch AVD select “existing AVD name” and click on “Start” then will get a popup of “Launch Options” you can also create manual screen size of AVD by check on checkbox of “Scale display to real size” then click on “Launch” button.


After launch you will get AVD like below figure.