Resources

App Resources

It takes more than just code to build a great app. Resources are the additional files and static content that your code uses, such as bitmaps, layout definitions, user interface strings, animation instructions, and more.

App Components

Android's application framework lets you create rich and innovative apps using a set of reusable components. This section explains how you can build the components that define the building blocks of your app and how to connect them together using intents.


App Manifest

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory. The manifest file presents essential information about your app to the Android system, information the system must have before it can run any of the app's code. Among other things, the manifest does the following:
  • It names the Java package for the application. The package name serves as a unique identifier for the application.
  • It describes the components of the application — the activities, services, broadcast receivers, and content providers that the application is composed of. It names the classes that implement each of the components and publishes their capabilities (for example, which Intent messages they can handle). These declarations let the Android system know what the components are and under what conditions they can be launched.
  • It determines which processes will host application components.
  • It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.
  • It also declares the permissions that others are required to have in order to interact with the application's components.
  • It lists the Instrumentation classes that provide profiling and other information as the application is running. These declarations are present in the manifest only while the application is being developed and tested; they're removed before the application is published.
  • It declares the minimum level of the Android API that the application requires.
  • It lists the libraries that the application must be linked against.

User Interface

Your app's user interface is everything that the user can see and interact with. Android provides a variety of pre-build UI components such as structured layout objects and UI controls that allow you to build the graphical user interface for your app. Android also provides other UI modules for special interfaces such as dialogs, notifications, and menus.

Media and Camera

Add video, audio, and photo capabilities to your app with Android's robust APIs for playing and recording media.

Location and Sensors APIs

Use sensors on the device to add rich location and motion capabilities to your app, from GPS or network location to accelerometer, gyroscope, temperature, barometer, and more.

Text and Input

Use text services to add conventient features such as copy/paste and spell checking to your app. You can also develop your own text services to offer custom IMEs, dictionaries, and spelling checkers that you can distribute to users as applications.

Android Studio Overview

Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. On top of the capabilities you expect from IntelliJ, Android Studio offers:
  • Flexible Gradle-based build system
  • Build variants and multiple apk file generation
  • Code templates to help you build common app features
  • Rich layout editor with support for drag and drop theme editing
  • Lint tools to catch performance, usability, version compatibility, and other problems
  • ProGuard and app-signing capabilities
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine
  • And much more
If you're new to Android Studio or the IntelliJ IDEA interface, this page provides an introduction to some key Android Studio features.
For specific Android Studio how-to documentation, see the pages in the Workflow section, such as Managing Projects from Android Studio and Building and Running from Android Studio

Android Developer Tools

ADT (Android Developer Tools) is a plugin for Eclipse that provides a suite of tools that are integrated with the Eclipse IDE. It offers you access to many features that help you develop Android applications. ADT provides GUI access to many of the command line SDK tools as well as a UI design tool for rapid prototyping, designing, and building of your application's user interface.
Note: If you have been using Eclipse with ADT, be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates. For help moving projects, seeMigrating to Android Studio.
If you still wish to use the ADT plugin for Eclipse, see Installing Eclipse Plugin.

Support Library

The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running Android 1.6 (API level 4) and up.
This guide provides information about what features are enabled by the Support Libraries, how to use them in your development environment and information about library releases.

Developer Workflow

To develop apps for Android, you use a set of tools that are included in Android Studio. In addition to using the tools from Android Studio, you can also access most of the SDK tools from the command line. Developing with Android Studio is the preferred method because it can directly invoke the tools that you need while developing applications.
However, you may choose to develop with another IDE or a simple text editor and invoke the tools on the command line or with scripts. This is a less streamlined way to develop because you will sometimes have to call command line tools manually, but you will have access to the same number of features that you would have in Android Studio.
Development process for Android applications
Figure 1. The development process for Android applications.

App Workflow


The basic steps for developing applications (with or without Android Studio) are shown in figure 1. The development steps encompass four development phases, which include:
  • Environment Setup
    During this phase you install and set up your development environment. You also create Android Virtual Devices (AVDs) and connect hardware devices on which you can install your applications.
    See Managing Virtual Devices and Using Hardware Devices for more information.
  • Project Setup and Development
    During this phase you set up and develop your Android Studio project and application modules, which contain all of the source code and resource files for your application. For more information, see Create an Android project.
  • Building, Debugging and Testing
    During this phase you build your project into a debuggable .apk package(s) that you can install and run on the emulator or an Android-powered device. Android Studio uses a build system based onGradle that provides flexibility, customized build variants, dependency resolution, and much more. If you're using another IDE, you can build your project using Gradle and install it on a device using adb. For more information, see Build and run your application.
    Next, with Android Studio you debug your application using the Android Debug Monitor and device log messages (logact) along with the IntelliJ IDEA intelligent coding features. You can also use a JDWP-compliant debugger along with the debugging and logging tools that are provided with the Android SDK. For more information see Debug your application with the SDK debugging and logging tools.
    Last, you test your application using various Android SDK testing tools. For more information, see Test your application with the Testing and Instrumentation framework.
  • Publishing
    During this phase you configure and build your application for release and distribute your application to users. For more information, see Publishing Overview.

Build System Overview

VIDEO

The New Android SDK Build System
The Android build system is the toolkit you use to build, test, run and package your apps. The build system can run as an integrated tool from the Android Studio menu and independently from the command line. You can use the features of the build system to:
  • Customize, configure, and extend the build process.
  • Create multiple APKs for your app with different features using the same project and modules.
  • Reuse code and resources across source sets.
The flexibility of the Android build system enables you to achieve all of this without modifying your app's core source files. To build an Android Studio project, see Building and Running from Android Studio. To configure custom build settings in an Android Studio project, see Configuring Gradle Builds.


No comments:

Post a Comment