Android Development
Process & Tools
by Lope Emano
The Android Stack
Overview
● Setting up development environment
● Android Studio
● Android AVD & SDK Manager
● Project Structure Overview
● Hello World!
Setting up the environment
● Download & install JDK 1.6 or jdk-6 from Oracle
Oracle password requirements can be a pain (needs
capital letters, 11 chars)
● set JDK_HOME environment variable
● Download and install Android Studio
v0.8.0, June 2014
Where to find Environment Variables Dialog
How to set System Variable
Android Studio
● Based on IntelliJ IDE
● Replaces Eclipse as the standard Android
Development IDE
● Announced on 16 May 2013 at the Google I/O
● Still in beta
● Live Layout & Real-time App Rendering
● Template-based wizards to create common Android
designs and components
● More!
AVD Manager and Android SDK
in Android Studio
SDK Manager
The Android SDK separates tools, platforms, and
other components into packages you can download
using the SDK Manager.
● Download different versions of the Android SDK
● Different System Images for testing purposes
● Download build tools and its different images
● Download developer preview sdks, i.e. Android L
Android SDK Manager
AVD Manager
provides a graphical user interface in which you can
create and manage Android Virtual Devices (AVDs),
which are required by the Android Emulator
AVD Manager
Creating an AVD
The Emulator
Enabling Developer Options (Device)
Enabling USB Debugging (Device)
Running and Debugging
Creating a new project
Templates
Finish!
Hello World
Android Project Structure
Project Structure
Two main directories:
i. src/main/java
known as source folder in Android project includes
stub MainActivity.java file. They contain the java code of
the application.
Project Structure
Two main directories:
ii. src/main/res
Contains all the resources required like images,
layouts and values.
Resources are external files(non-code files) that are
used by your code and compiled into your application at
build time.
Android Supports a number of different kinds of
resources files, including XML, PNG and MP3 files.
Project Structure
The resources (src/main/res) folder:
● res/drawable
drawable-xhdpi, drawable-hdpi, drawable-mdpi for
multiple screen size support.
● res/layout
layouts are expressed in xml format
● res/layout-land
layout for landscape mode
● res/values
colors, text copies
● res/menu
where you define your menu items in xml format
Project Structure
Screen densities:
● Dots Per Inch (DPI) or Pixels Per Inch
The number of individual dots that can be placed in a
line within the span of 1 inch
● Density-independent pixel
A virtual pixel unit that you should use when defining
UI layout, to express layout dimensions or position in a
density-independent way
HDPI and MDPI
Images relative to DPI
Project Structure
The AndroidManifest.xml file
● Every application must have this file (with precisely
that name) in its root directory.
● Presents essential information about your app to the
Android system.
● Names the Java package for the application. The
package name serves as a unique identifier for the
application. “com.google.android.gmail”
● Specifies the app’s name, versionCode, launcher icon,
starting activity
● Specifies the different permissions needed to run the
app
AndroidManifest.xml
Project Structure
The build.gradle file
● Gradle is a project automation tool
● Manages library dependencies, version for each
library and where to get them
● Manages build types, i.e. debug build / release build
● Specify the version of the android sdk to be used
● and a whole lot more!
build.gradle
What we’ve learned:
● The project structure provides support for multiple
screen types
● Building your first app is easy
● I don’t need a device to start working on the android
app I want to build
● The AndroidManifest.xml file can be tedious so I really
need to read the docs in order to configure my
android app properly
● Gradle can be very useful, especially on a team
setting
References:
● http://androidmyway.wordpress.
com/2012/03/31/folder-structure-for-android-project-in-
eclipse-2/
● http://developer.android.
com/reference/android/Manifest.permission.html
● http://developer.android.com/tools/help/sdk-manager.
html
● http://developer.android.com/tools/help/emulator.html
● http://en.wikipedia.org/wiki/Gradle

Android Development - Process & Tools

  • 1.
    Android Development Process &Tools by Lope Emano
  • 2.
  • 3.
    Overview ● Setting updevelopment environment ● Android Studio ● Android AVD & SDK Manager ● Project Structure Overview ● Hello World!
  • 4.
    Setting up theenvironment ● Download & install JDK 1.6 or jdk-6 from Oracle Oracle password requirements can be a pain (needs capital letters, 11 chars) ● set JDK_HOME environment variable ● Download and install Android Studio v0.8.0, June 2014
  • 5.
    Where to findEnvironment Variables Dialog
  • 6.
    How to setSystem Variable
  • 7.
    Android Studio ● Basedon IntelliJ IDE ● Replaces Eclipse as the standard Android Development IDE ● Announced on 16 May 2013 at the Google I/O ● Still in beta ● Live Layout & Real-time App Rendering ● Template-based wizards to create common Android designs and components ● More!
  • 9.
    AVD Manager andAndroid SDK in Android Studio
  • 10.
    SDK Manager The AndroidSDK separates tools, platforms, and other components into packages you can download using the SDK Manager. ● Download different versions of the Android SDK ● Different System Images for testing purposes ● Download build tools and its different images ● Download developer preview sdks, i.e. Android L
  • 11.
  • 12.
    AVD Manager provides agraphical user interface in which you can create and manage Android Virtual Devices (AVDs), which are required by the Android Emulator
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
    Project Structure Two maindirectories: i. src/main/java known as source folder in Android project includes stub MainActivity.java file. They contain the java code of the application.
  • 25.
    Project Structure Two maindirectories: ii. src/main/res Contains all the resources required like images, layouts and values. Resources are external files(non-code files) that are used by your code and compiled into your application at build time. Android Supports a number of different kinds of resources files, including XML, PNG and MP3 files.
  • 26.
    Project Structure The resources(src/main/res) folder: ● res/drawable drawable-xhdpi, drawable-hdpi, drawable-mdpi for multiple screen size support. ● res/layout layouts are expressed in xml format ● res/layout-land layout for landscape mode ● res/values colors, text copies ● res/menu where you define your menu items in xml format
  • 27.
    Project Structure Screen densities: ●Dots Per Inch (DPI) or Pixels Per Inch The number of individual dots that can be placed in a line within the span of 1 inch ● Density-independent pixel A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way
  • 28.
  • 29.
  • 30.
    Project Structure The AndroidManifest.xmlfile ● Every application must have this file (with precisely that name) in its root directory. ● Presents essential information about your app to the Android system. ● Names the Java package for the application. The package name serves as a unique identifier for the application. “com.google.android.gmail” ● Specifies the app’s name, versionCode, launcher icon, starting activity ● Specifies the different permissions needed to run the app
  • 31.
  • 32.
    Project Structure The build.gradlefile ● Gradle is a project automation tool ● Manages library dependencies, version for each library and where to get them ● Manages build types, i.e. debug build / release build ● Specify the version of the android sdk to be used ● and a whole lot more!
  • 33.
  • 34.
    What we’ve learned: ●The project structure provides support for multiple screen types ● Building your first app is easy ● I don’t need a device to start working on the android app I want to build ● The AndroidManifest.xml file can be tedious so I really need to read the docs in order to configure my android app properly ● Gradle can be very useful, especially on a team setting
  • 35.
    References: ● http://androidmyway.wordpress. com/2012/03/31/folder-structure-for-android-project-in- eclipse-2/ ● http://developer.android. com/reference/android/Manifest.permission.html ●http://developer.android.com/tools/help/sdk-manager. html ● http://developer.android.com/tools/help/emulator.html ● http://en.wikipedia.org/wiki/Gradle