Android Development Tools – The Android SDK includes several tools and utilities to help you create, test, and debug your projects. A detailed examination of each developer tool is outside the scope of this book, but it’s worth briefly reviewing what’s available.
➤ The Android SDK and Virtual Device Manager Used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD hosts an emulator running a particular build of Android, letting you specify the supported SDK version, screen resolution, amount of SD card storage available, and available hardware capabilities (such as touchscreens and GPS).
➤ The Android Emulator An implementation of the Android virtual machine designed to run within a virtual device on your development computer. Use the emulator to test and debug your Android applications.
➤ Dalvik Debug Monitoring Service (DDMS) Use the DDMS perspective to monitor and control the Dalvik virtual machines on which you’re debugging your applications.
➤ Android Asset Packaging Tool (AAPT) Constructs the distributable Android package files ( .apk ).
➤ Android Debug Bridge (ADB) A client-server application that provides a link to a running emulator. It lets you copy files, install compiled application packages ( .apk ), and run shell commands.
The following additional tools are also available:
➤ SQLite3 A database tool that you can use to access the SQLite database files created and used by Android.
➤ Traceview A graphical analysis tool for viewing the trace logs from your Android application.
➤ MkSDCard Creates an SD card disk image that can be used by the emulator to simulate an external storage card.
➤ Dx Converts Java .class bytecode into Android .dex bytecode.
➤ activityCreator A script that builds Ant build files that you can then use to compile your Android applications without the ADT plug-in.
➤ layoutOpt A tool that analyzes your layout resources and suggests improvements and optimizations.
Let’s take a look at some of the more important tools in more detail.
The Android Virtual Device and SDK Manager
The Virtual Device and SDK Manager is a tool used to create and manage the virtual devices that will host instances of your emulator. You can use the same tool both to see which version of the SDK you have installed and to install new SDKs when they are released.
Android Virtual Devices
Android Virtual Devices are used to simulate the software builds and hardware specifications available on different devices. This lets you test your application on a variety of hardware platforms without needing to buy a variety of phones.
Each virtual device is configured with a name, a target build of Android (based on the SDK version it supports), an SD Card capacity, and screen resolution, as shown in the ‘‘Create new AVD’’ dialog in Figure Below.
Each virtual device also supports a number of specific hardware settings and restrictions that can be added in the form of NVPs in the hardware table. These additional settings include:
➤ Maximum virtual machine heap size
➤ Screen pixel density
➤ SD Card support
➤ The existence of DPad, touchscreen, keyboard, and trackball hardware
➤ Accelerometer and GPS support
➤ Available device memory
➤ Camera hardware (and resolution)
➤ Support for audio recording
Different hardware settings and screen resolutions will present alternative user-interface skins to represent the different hardware configurations. This simulates a variety of mobile device types. To complete the illusion, you can create a custom skin for each virtual device to make it look like the device it is emulating.
Use the installed and available package tabs to manage your SDK installations.
Installed Packages, shown in Figure Below, displays the SDK platforms, documentation, and tools you have available to use in your development environment. When updating to a new version you can simply click the Update All. . . button to have the manager update your SDK installation with the latest version of each component.
Alternatively, Available Packages checks the Android SDK repository for any source, packages, and archives available but not yet installed on your system. Use the checkboxes, as shown in Figure Below, to select additional SDK packages to install.
The Android Emulator
The emulator is the perfect tool for testing and debugging your applications.
The emulator is an implementation of the Dalvik virtual machine, making it as valid a platform for running Android applications as any Android phone. Because it’s decoupled from any particular hardware, it’s an excellent baseline to use for testing your applications.
Full network connectivity is provided along with the ability to tweak the Internet connection speed and latency while debugging your applications. You can also simulate placing and receiving voice calls and SMS messages.
The ADT plug-in integrates the emulator into Eclipse so that it’s launched automatically within the selected AVD when you run or debug your projects. If you aren’t using the plug-in or want to use the emulator outside of Eclipse, you can telnet into the emulator and control it from its console.
To execute the emulator you first need to create a virtual device, as described in the previous section. The emulator will launch the virtual device and run a Dalvik instance within it.
Dalvik Debug Monitor Service (DDMS)
The emulator lets you see how your application will look, behave, and interact, but to really see what’s happening under the surface you need the Dalvik Debug Monitoring Service. The DDMS is a powerful debugging tool that lets you interrogate active processes, view the stack and heap, watch and pause active threads, and explore the file system of any connected Android device.
The DDMS perspective in Eclipse also provides simplified access to screen captures of the emulator and the logs generated by LogCat.
If you’re using the ADT plug-in, the DDMS is fully integrated into Eclipse and is available from the DDMS perspective. If you aren’t using the plug-in or Eclipse, you can run DDMS from the command line and it will automatically connect to any running device or emulator.
The Android Debug Bridge (ADB)
The Android debug bridge (ADB) is a client-service application that lets you connect with an Android Emulator or device. It’s made up of three components: a daemon running on the emulator, a service that runs on your development hardware, and client applications (like the DDMS) that communicate with the daemon through the service.
As a communications conduit between your development hardware and the Android device/emulator, the ADB lets you install applications, push and pull files, and run shell commands on the target device. Using the device shell you can change logging settings, and query or modify SQLite databases available on the device.
The ADT tool automates and simplifies a lot of the usual interaction with the ADB, including application installation and updating, file logging, and file transfer (through the DDMS perspective).
If You Like This Post Please Suggest More Blog And For More Hacking Content Click Here