Because Android applications run within the Dalvik Virtual Machine, you can write them on any platform that supports the developer tools. This currently includes the following:
1. Microsoft Windows (XP or later)
2. Mac OS X 10.4.8 or later (Intel chips only)
To get started, you‘ll need to download and install the following:
The Android SDK
1. Java Development Kit (JDK) 5 or 6
2. Download the latest JDK from Sun at https://java.sun.com/javase/downloads/index.jsp
• We can download the latest version of the SDK for your development platform from the Android development homepage at https://developer.android.com/sdk/index.html
• The SDK is presented as a ZIP file containing only the latest version of the Android developer tools. Install it by unzipping the SDK into a new folder.
• Before we can begin development, you need to add at least one SDK Platform; do this on Windows by running the _SDK Setup.exe‘‘ executable, or on MacOS or Linux by running the _ android‘‘ executable in the tools subfolder.
• In the screen that appears, select the_ Available Packages‘‘ option on the left panel, and then select the SDK Platform versions you wish to install in the _ Sources, Packages, and Archives‘‘ panel on the right.
• The selected platform will then be downloaded to your SDK installation folder and will contain the API libraries, documentation, and several sample applications.
Using Eclipse with the ADT plug-in for your ANDROID DEVELOPMENT offers some significant features:
• Eclipse is an open-source IDE (integrated development environment) particularly popular for Java development.
• It‘s available for download for each of the development platforms supported by Android Windows, MacOS and Linux from the Eclipse foundation homepage:
There are many variations available; the following is the recommended configuration for Android:
• Eclipse 3.4 or 3.5 (Galileo)
• Eclipse JDT plug-in
WST and the JDT plug-in are included in most Eclipse IDE packages.
Installing Eclipse consists of uncompressing the download into a new folder. When that‘s done, run the eclipse executable. When it starts for the first time, create a new workspace for your Android development projects.
Install the developer tools plug-in by following these steps:
1. Select Help -> Install New Software. . . from within Eclipse.
2. In the resulting dialog box, enter the following address into the Work With text entry box and press Enter: https://dl-ssl.google.com/android/eclipse/
3. Eclipse will now search for the ADT plug-in. When finished, it will display the available plugin. Select it by clicking the checkbox next to the Developer Tools root node, and click Next.
4. Eclipse will now download the plug-in. When it‘s finished, ensure both the Android DDMS and Android Developer Tools plug-ins are selected and click Next.
5. Read and then Accept the terms of the license agreement, and click Next and then Finish. As the ADT plug-in is not signed, you‘ll be prompted before the installation continues.
6. When installation is complete you‘ll have to restart Eclipse and update the ADT preferences.Restart and select Window --> Preferences. . . (or Eclipse --> Preferences for MacOS).
7. Then select Android from the left panel.
8. Click Browse. . . and navigate to the folder into which you unzipped the Android SDK; then click Apply. The list will then update to display each of the available SDK targets. Click OK to complete the SDK installation.
You‘ve downloaded the SDK, installed Eclipse, and plugged in the plug-in. You‘re now ready to start programming for Android. Start by creating a new project and setting up your Eclipse run and debug configurations.
An Android project contains all the files that comprise the source code for your Android app.
To create a new Android project using the Android New Project Wizard, do the following:
1. Select File -> New ? Project.
2. Select the Android Project application type from the Android folder and click Next.
3. In the dialog that appears, enter the details for your new project. The _ Project name‘‘ is the name of your project file _ the Package name‘‘ specifies its Java package; Create Activity lets you specify the name of a class that will be your initial Activity; and the _ Application name‘‘ is the friendly name for your application. _ Min SDK Version‘‘ lets you specify the minimum version of the SDK that your application will run on. When you‘ve entered the details, click Finish.
Before launching the emulator, you must create an Android Virtual Device (AVD) which defines the system image and device settings used by the emulator. Some of the settings are,
• configure the version of the Android system
• size of the SD card
• set of hardware options
• emulator skin
• screen resolution, etc.
An Android Virtual Device (AVD) definition lets you define the characteristics of an Android phone, tablet, Android Wear, or Android TV device that you want to simulate in the Android Emulator. The AVD Manager helps you easily create and manage AVDs.
|………>Name(enter some name Ex:saitech)
|…………….>Target(select version with API level Ex :2.2,8)
|……………> create AVD.
|……………….>Right Click(Run As)
Launch configurations let you specify runtime options for running and debugging applications. Using a launch configuration, you can specify the following:
• The Project and Activity to launch
• The virtual device and emulator options to use
• Input/output settings (including console defaults)
We can specify different launch configurations for running and debugging applications. The following steps show how to create a launch configuration for an Android application:
1. Select Run Configurations. . . or Debug Configurations. . . from the Run menu.
2. Right-click Android Application on the project type list, and select New.
3. Enter a name for the configuration. You can create multiple configurations for each project, so create a descriptive title that will help you identify this particular setup.
4. Now choose your start-up options. The first (Android) tab lets you select the project to run and the Activity that you want to start when you run (or debug) the application.
5. Use the Target tab, to select the default virtual device to launch on, or select manual to select a device or AVD each time.
6. Finally, set any additional properties in the Common tab.
7. Click Apply, and your launch configuration will be saved.
You‘ve created your first project and created the run and debug configurations for it. Before making any changes, test your installation and configurations by running and debugging the Hello World project. From the Run menu, select Run or Debug to launch the most recently selected configuration, or select Run Configurations or Debug Configurations to select a specific configuration to use.
Get Updates on Tech posts, Interview & Certification questions and training schedules