Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Android Developer Tools Essentials
Preface
Requirements for Android Developer Tools
Development Process for Android Developer Tools
Development on a Variety of OS Platforms
Conventions Used in This Book
Using Code Examples
SafariĀ® Books Online
How to Contact Us
Acknowledgments
1. Getting Started
Minimum Requirements
Installing Java
Installing the Android Software Development Kit
Installing the ADT Bundle
Downloading the ADT bundle
Extracting the tools to Android Home
Unzip the downloaded artifact to the Android folder
Setting your PATH variable
Validating the installation
Developing Without Eclipse
Command-Line Usage
Using a Different IDE
Configuring a Device for Development
2. Essential Tools
SDK Manager
SDK Components
Starting the SDK Manager
Viewing Installed and Available Components
Selecting packages
Installing packages
Deleting and updating components
Managing dependencies
ADT Preview Channel
Enable the Preview Channel
Installing Preview Tools
Reverting to released tools
Android Debug Bridge (ADB)
Starting ADB
Querying for Device Instances
Find connected devices
Directing a command to a specific device
Issuing Commands
Transferring files
Managing applications on a device
The Shell Command
Interactive mode
One-off mode
Retrieving system data
Using the Activity Manager
ADB Does a Lot More
Resetting the ADB Server
Additional Resources
3. Configuring Devices and Emulators
Using a Physical Device for Development
Capabilities and Limitations
Capabilities
Limitations
Configuring a Physical Device for Development
Using an Emulator for Development
Supported Features
Supported features
Unsupported features
Android Virtual Devices
Creating AVDs
AVD Manager
Creating AVDs from the command line
Location of the AVD files
Emulator Options
Advanced Emulator Configuration
Using Hardware Acceleration
Benefits
Limitations
Downloading the components
Installing the HAXM software
Configuring an AVD
Validating that HAXM is running
Disabling the Boot Animation
On Windows: Dedicating a Core to the Emulator
4. Using Devices and Emulators
Using the Emulator
Starting the Emulator
AVD launch options
Starting an emulator from the command line
Using snapshots to improve performance
Saving and retrieving a snapshot
The Emulator Application
The Devices Tool
Keyboard Shortcuts
File Explorer
Developer Tools Application
5. Developing with Eclipse
Anatomy of the Eclipse Workspace
Uncovering Additional Tools and Views
Quick Button
Code Templates
Properties Editors
XML Formatter
The Android Key
Quick Outline for XML
Other Essential Eclipse Shortcuts
Refactor Menu
6. Developing with Android Studio
Installing Android Studio
Bundled SDK
Default Project Location
Anatomy of the Android Studio IDE
Panels
Toolbars
Useful Actions in Android Studio
Navigation
The New Structure of an Android Project
A Tour Around the New Structure
Running and Debugging an Android Project
Creating New Android Components
Layout Designer and Layout Preview
Layout Designer
Layout Preview
Generating an APK
Interacting with Maven and Gradle
Interacting with Maven
Interacting with Gradle
Version Control Integration
Migrating from Eclipse
Android Studio Tips and Tricks
Refactoring and Code Generation
Miscellaneous Shortcuts
7. Testing Your Code
Logcat
Viewing the Logcat File
Anatomy of a Log Message
Reading logcat output
Filtering Based on Logging Level
Using Tags to Filter Output
Getting the Most Out of Logcat
Viewing Alternative Log Buffers
Predefined Output Formats
Logcat Viewer in Eclipse
Logcat Example
Determining areas to monitor
Creating log statements
Verbose logging
Filtering the logcat
Debugging
Setting Your App to Debuggable
Setting a Debug Point
The Eclipse Debug Perspective
Debugging Example
Setting the debug points
Starting the debugger
Stepping through the code
Lint
Command-Line Usage
Excluding issues
Running in Eclipse
Lint toolbar menu
Java and XML editor integration
Quick Fix tool
8. Simulating Events
Simulating Location and Routes
Simulating Telephony Operations
Changing Networking Parameters
Using a Device with Sensor Emulation
Advanced Sensor Testing
Supported Sensors
Simulating Sensor Events in Real Time
Recording Sensor Scenarios
Developer Options Menu
9. Build Tools
Compiling Your Code
Packaging an APK for Release
Signing Your App
Building from the Command Line Using Ant
Setting Up Your Project
Creating the Ant build.xml file
Building applications from multiple source libraries
Building in Debug Mode
Building an App to Release to the Play Store
Signing an app with a custom keystore
Storing the password information
Additional Ant Commands
Advanced Packaging Steps
ProGuard
Enabling Proguard
Configuring ProGuard
Viewing obfuscated code
Zipalign
Gradle-Based Build Tools
Installing Gradle
Creating Multiple Build Variations
Example
Build File
Build Tasks
Generating a Gradle Build from Eclipse
Using the Maven Tools
10. Monitoring System Resources
Memory Usage in Android
Dalvik Debug Monitor Server (DDMS)
Launching the DDMS Perspective
Analyzer Tool
Running the tool
Viewing the results of Analyzer Tool
Threads
Running the Threads tool
Viewing thread information
Heap
Running the Heap tool
Viewing heap information
Traceview
Traceview outputātimeline panel (top section)
Profile panel
Memory Analyzer Tool (MAT)
Generating an HPROF File
HPROF File
Installing MAT into Eclipse
Launching MAT from Within Eclipse
Using MAT to Analyze HRPOF Files
The MAT Overview Screen
Viewing a Report
11. Working with the User Interface
Android Layout Basic Concepts
Defining Layouts Using XML
Views and ViewGroups
Resources
Leveraging ADT to Build Great UIs
Editing XML Files Directly
Using Templates
Editing XML Directly
Code completion
Inserting new layouts or widgets
Attribute values
Refactor menu
XML formatting
Editor Preferences menu
Working with Graphics
The Asset Tool
Using Nine-Patch Images
Asset Studio Website
12. Using the Graphical Editor
Generating Layouts Using the Graphical Layout Editor
Palette
Canvas
Layout Actions
Context-Sensitive Menu
Outline View
Properties Editor
Configuration Chooser
13. Optimizing the User Interface
Introduction to UI Performance
How Android Draws Views, and How It Affects UI Performance
Two-pass layout
Nested layouts reduce performance
Hierarchy Viewer
Starting the Hierarchy Viewer
Loading the View Hierarchy into the Tools
Navigating the Tree Hierarchy
Gathering View Information
Measurement information
Identification and performance indicators
Gathering View Rendering Details
Example: Debugging a UI Using the Hierarchy Viewer
Different ways to design a UI
Using the Tree View to get timing information
Reviewing the structure with the Tree Overview
Using the Tree tool to inspect the bad UI
Using the Tree tool to inspect the good UI
Fixing Problems Using Lint
Application Exerciser Monkey
Grooming the Monkey
Letting the Monkey free
Specifying event types and frequency
Verbosity level
Setting a seed value
Monkeyrunner
Using Python to Create the Script
Thanks for Reading!
Index
About the Author
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →