android 5 lollipop development tools - sdjug · • the bad news for eclipse users: you may be...

198
Copyright (c) 2015 Servin Corp Android 5 Lollipop Development Tools Norman McEntire [email protected] 1

Upload: others

Post on 24-Oct-2019

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android 5 Lollipop Development Tools

Norman McEntire [email protected]

1

Page 2: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Opening Remarks• Welcome!

• Thank you for attending!

• My promise to you

• Provide a solid introduction to Android 5 Lollipop Development Tools

• Android Studio

2

Page 3: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

About Myself• Norman McEntire

[email protected]

• BS/MS Computer Engineering

• USC - University of South Carolina

• 30+ Years Computer Engineering Experience

• Hardware Engineering (chips, boards, systems)

• Software Engineering (drivers, systems software, mobile apps)

• Current Software Focus: Android/Java, iOS 8/ObjC/Swift, IoT, Linux

3

Page 4: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

How To Take This Course• Option 1 - Corporate Training

• Contact me at [email protected] to schedule this Android course at your corporation

• Option 2 - UCSD Extension Course

• http://extension.ucsd.edu/studyarea/index.cfm?vAction=singleCourse&vCourse=CSE-41145&vsacategoryid=166&vStudyAreaID=14

4

Page 5: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

My Assumptions About You

• You are in one of two broadly defined groups

• Group 1. Experienced Android Software Developer

• You have been using Eclipse ADT

• Group 2. New to Android Software Development

• No experience with Eclipse ADT

• Common to both groups: Learn Android Studio!

5

Page 6: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Agenda

• Android 5 Development Tool Options

• Migrating from Eclipse ADT to Android Studio

• Using Android Studio

• Using Android Studio Tools

6

Page 7: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android 5 Development Tool Options

7

Page 8: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android 5 Development Tools Options

• You have three major options

• Option 1. Start Using Android Studio

• The official Android 5 IDE

• Option 2. Continue to use Eclipse ADT for now

• Migrate to Android Studio when you can

• Option 3. Use the command-line (no IDE)8

Page 9: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Why Android Studio

9

Page 10: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Requirements• Linux (e.g. Ubuntu 12.04)

• GNOME or KDE, glibc 2.11 or higher

• JDK 7

• Mac OS X

• 10.8.5 or higher

• JDK 7

• NOTE: Run Android Studio with JDK 1.6 for optimized rendering, but use JDK 7 for building Android code

• Windows

• Windows 7, 8

• JDK 7

10

Page 11: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Downloads

11

Page 12: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Eclipse IDE and Android Studio IDE

• The Good News About Android Studio

• It is highly integrated with the Android Java build environment

• Example 1: GUI layout much easier (see multiple layouts at same time)

• Example 2: Build Variants (build “free" and “paid” version of app at same time)

• The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and now you have “yet another IDE” to learn

12

Page 13: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Exporting Your Eclipse Project for Import to

Android Studio

13

Page 14: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Steps To Migrate Your Eclipse Project To Android Studio

• Step 1 [In Eclipse]. Export your project

• Step 2 [In Studio]. Close all open projects

• Step 3 [In Studio]. Select Import Non-Android Studio Project

14

Page 15: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

To Create an Archive File In Eclipse

15

Page 16: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Archive File In Eclipse

16

Page 17: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Migrating From Eclipse ADT to Android Studio

17

Page 18: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Migrating To Android Studio

18

Page 19: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Steps To Migrate Your Eclipse Project To Android Studio

• Step 1 [In Eclipse]. Export your project

• Step 2 [In Studio]. Close all open projects

• Step 3 [In Studio]. Select Import Non-Android Studio Project

19

Page 20: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Demo Migrating from Eclipse ADT

Project to Android Studio

20

Page 21: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio 1.1 Startup

21

Page 22: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Startup

22

Page 23: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Import Non-Android Studio Project

23

Page 24: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Select Project To Import

24

Page 25: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Cannot Directly Import From Zip File

25

Page 26: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Unzip File, Then Import

26

Page 27: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Import Destination Directory

27

Page 28: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Import Project from Eclipse ADT

28

Page 29: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Import In Progress

29

Note: Notice use of Gradle to build project.

Page 30: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Results of Import

30

Page 31: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Build and Run In Android Studio

31

Page 32: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Device Chooser

32

Page 33: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android DDMS

33

Page 34: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Screen Capture

34

Page 35: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Captured Screen

35

Page 36: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Summary

• Built and Ran Android 5 App using Eclipse

• Exported from Eclipse to Android Studio

• Built and Ran Android 5 App using Android Studio

36

Page 37: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Demo Import Eclipse ADT Project

that has .jar files in the project

37

Page 38: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Eclipse ADT Project with .jar file (HelloJar.jar)

38

Page 39: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Export Project from Eclipse (Select Archive File)

39

Page 40: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Archive File (HelloAndroid5WithJar)

40

Page 41: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Import Into Android Studio

41

Page 42: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Select Directory

42

Page 43: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Destination Directory

43

Page 44: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

“ADT project importer can identify some .jar files”

44

Page 45: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Gradle Configuration

45

Page 46: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

build.gradle(Module: app)

46

Page 47: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Moved Files During Import

47

Page 48: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Results Shown In Android Studio

48

Page 49: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Using Android Studio

49

Page 50: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Startup

50

Page 51: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

New Project

51

Page 52: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Select Form Factors

52

Page 53: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Add Activity

53

Page 54: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Options for New File (Use Defaults)

54

Page 55: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Getting Project Ready (Takes a few moments)

55

Page 56: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Project Ready for Editing

56

Page 57: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Editing XML Layout

57

Page 58: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Editing MainActivity.java

58

Page 59: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Tracking status of the build

59

Page 60: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Device Chooser

60

Page 61: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Screen Capture

61

Page 62: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skills

62

Page 63: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Code Completion

• Just start typing and Android Studio will show you choices

• Just press ENTER to complete a given choice

• Also press TAB go to next parameter

• Example

• Toast.makeText(this,”hi”,Toast.LENGTH_LONG).show()

63

Page 64: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill SmartType Code Completion• When you get to certain locations in your code,

press Shift+Control+Spacebar to see choices based on context

• Example

• StringBuffer sb = new Shift+Control+SpaceBar

• Calendar now = new GregorianCalendar(Shift+Control+SpaceBar)

64

Page 65: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Navigate in Current File

• To navigate in the current file

• Option 1 [Menu]. Navigate, File Structure

• Then select member you want to navigate to

• Option 2 [Kbd]. Command+F12

• Then select member you want to navigate to

65

Page 66: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Quickly View Definition

• To view a quick definition of a class

• Step 1. Highlight a given class name

• Step 2 [Menu]. View, Quick Definition

66

Page 67: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Quickly View Documentation• To quickly view documentation of a class

• Step 1. Highlight a given class name

• Step 2.

• Option 1 [Menu]. View, Quick Documentation

• Option 2 [Kbd]. F1

67

Page 68: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Navigate to Declaration

• To navigate to the declaration of a class, variable, or method

• Step 1. Position cursor on name

• Step 2.

• Option 1 [Menu]. Navigate, Declaration

• Option 2 [Kbd]. Command+b

68

Page 69: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Refactor a Name

• To refactor a name of a class, method, or variable

• Step 1. Position cursor on name

• Step 2.

• Option 1 [Menu]. Refactor, Rename

• Option 2 [Kbd]. Shift+F6

69

Page 70: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Display Override Methods

• To display list of methods you can override in the base class

• Option 1 [Menu]. Code, Override Methods

• Option 2 [Kbd]. Control+o

• NOTE: You can also “just start typing the name”

70

Page 71: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Display Methods of Interface

• To display list of methods you can implement in an interface

• Option 1 [Menu]. Code, Implement Methods

• Option 2 [Kbd]. Control+i

71

Page 72: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Add New File To Project

• To add a new file to your project

• Step 1. Click on “folder” where you want to create the file (e.g. java, res, etc)

• Option 1 [Menu]. File, New

• Option 2 [MacKbd]. Command+n

• Option 2 [WinKbd]. Alt+Insert

72

Page 73: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Results of Adding Demo Class

73

Page 74: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Skill Generate Code

• To generate code for a class (e.g. constructor, getter/setter, etc.)

• Step 1. Click on location where you want the code generated

• Option 1 [Menu]. Code, Generate

• Option 2 [MacKbd]. Command+n

• Option 2 [WinKbd]. Alt+Insert74

Page 75: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Results of Code Generation

75

Page 76: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Using Android Studio Templates

76

Page 77: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

No Activity

77

Page 78: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

No Activity

78

Page 79: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

New Project

79

Page 80: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Select Form Factor

80

Page 81: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

(Optional) Add Activity

81

Page 82: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Result

82

Page 83: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

AndroidManifest.xml

83

Page 84: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Blank Activity

84

Page 85: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Blank Activity

85

Page 86: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Blank Activity

86

Page 87: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

AndroidManifest.xml

87

Page 88: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp88

Page 89: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp89

Page 90: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Blank Activitywith Fragment

90

Page 91: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Blank Activity

91

Page 92: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

AndroidManifest.xml

92

Page 93: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

MainActivity.java - 1

93

Page 94: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

MainActivity.java - 2

94

Page 95: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

activity_main.xml

95

Page 96: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

fragment_activity_main.xml

96

Page 97: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Fullscreen Activity

97

Page 98: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Fullscreen Activity

98

Page 99: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Result

99

Page 100: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Google Maps Activity

100

Page 101: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Google Maps Activity

101

Page 102: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Google Play Services Activity

102

Page 103: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Google Play Services Activity

103

Page 104: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Login Activity

104

Page 105: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Login Activity

105

Page 106: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Master/Detail Flow

106

Page 107: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Master/Detail Flow

107

Page 108: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Navigation Draw Activity

108

Page 109: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Navigation Draw Activity

109

Page 110: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Settings Activity

110

Page 111: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Settings Activity

111

Page 112: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Tabbed Activity

112

Page 113: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Tabbed Activity

113

Page 114: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Gradle Build Scripts

114

Page 115: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Gradle Build Scripts

115

Page 116: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

build.grade (Project)

116

Page 117: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

build.grade (app)

117

Page 118: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

gradle-wrapper.properties

118

Page 119: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

gradle-wrapper.properties

119

Page 120: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio DDMS Options

120

Page 121: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Screen Capture

121

Page 122: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Screen Recorder

122

Page 123: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information

123

Page 124: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information Activity Manager State

124

Page 125: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information Package Information

125

Page 126: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information Memory Usage

126

Page 127: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information Memory Usage Over Time

127

Page 128: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

System Information Graphics State

128

Page 129: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Memory Monitor

129

Page 130: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Studio Dynamic Layout

130

Page 131: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Dynamic Layout• Three Options

• Design View

• Drag from Palette to Preview or Component Tree

• Text View

• Preview

131

Page 132: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Dynamic Design Preview Choices

• You can preview all of the following

• Different Device Images

• Different Display Densities

• Different UI Modes

• Different Android Versions

132

Page 133: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Motivation For Dynamic Layout

133

Page 134: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Design View

134

Page 135: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Text View

135

Page 136: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Dynamic Preview based on API Version

136

Page 137: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Dynamic Preview based on Screen Size

137

Page 138: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Keeping Android Studio Up-To-Date

138

Page 139: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Four Update Channels

139

Page 140: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Easy Access to Android Code Samples via

GitHub

140

Page 141: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Open Project From GitHub Code Samples

141

Page 142: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Code Samples from GitHub Description

142

Page 143: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Code Samples from GitHub Preview

143

Page 144: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Code Samples from GitHub Import Sample

144

Page 145: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Possible Error When Importing Sample Projects

145

Page 146: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Installing Build Tools License Agreement

146

Page 147: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Installing Build Tools Installing Requested Components

147

Page 148: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Device Monitor

148

Page 149: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Starting Android Device Monitor From Android Studio

149

Page 150: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Device Monitor

150

Page 151: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android SDK Manager

151

Page 152: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Starting Android SDK Manager From Android Studio

152

Page 153: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android SDK Manager

153

Page 154: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager

154

Page 155: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Starting Android Virtual Device (AVD) Manager From Android Studio

155

Page 156: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Create Device

156

Page 157: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Choose Device

157

Page 158: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - System Image

158

Page 159: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Verify Configuration

159

Page 160: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Your Virtual Device

160

Page 161: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Startup

161

Page 162: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Virtual Device (AVD) Manager - Startup

162

Page 163: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Code Running on Emulator

163

Page 164: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Android Build System

• Previous Android Build System

• Eclipse ADT with ANT

• New Build System

• Android Studio with Gradle

164

Page 165: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Two Options for the Build System

• Option 1.

• Use features of Android Studio without any focus on the underlying build system

• Create single APK

• Option 2.

• Customize the build system

• Create multiple APKs using same project

• Reuse code and resources across project sets

165

Page 166: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Gradle Build Script• The build files are called build.gradle

• They are plain text files

• They use the Groovy syntax to configure the build

• With elements provided by the Android plugin for Gradle

• In most cases, you only need to edit build files at the module level (see next slide)

166

Page 167: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Normally only edit build.gradle at Module Level

167

Page 168: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Key Point: The Android Build System enables you to customize build WITHOUT modification to app source files!

168

Page 169: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

The "apply" line includes Android-Specific Elements

169

Page 170: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

The android Element configures all Android-specific build options

170

Page 171: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

compileSdkVersion

171

Page 172: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

buildToolsVersion (always higher than compileSdkVersion)

172

Page 173: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

defaultConfig (override settings in AndroidManifest.xml)

(apply to all build variants)

173

Page 174: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

buildTypes (how to build and package app)

174

Note: By default, build system defines two types: debug and release

Page 175: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

dependencies

175

Page 176: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Important! Making changes to build system

requires a sync! (see next slide)

176

Page 177: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Sync Now

177

Page 178: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

applicationId

• Use applicationId to uniquely identify application packages for publishing

178

Page 179: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

applicationId

179

Key Point: applicationIdspecified inbuild.grade,and NOT in

AndroidManifest.xml

Page 180: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Build Variants Demo

180

Page 181: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Build Variants Demo• This demo will show how to create to build

variants from a single project

• A Free (Limited Featured) Version

• A Paid (Fully Featured) Version

• Both versions will have the same MainActivity

• Each version will have a different SecondActivity

181

Page 182: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 1. Define Two Product Flavors

182

Page 183: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 2. Make sure grade performs a sync

183

Page 184: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 3. Select the “freeDebug”

184

Page 185: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 4. Add Directories for “free” Product Flavor

185

Page 186: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 5a. Right-Click on java, select New, Activity, Blank Activity

186

Page 187: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 5b. Add SecondActivity for “free” Product Flavor

187

Page 188: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Directory Structure for “free” Product Flavor

188

Page 189: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Selecting Different Product Flavors - freeDebug and paidDebug

189

Page 190: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Running In Demo Mode

190

Page 191: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Adding a .jar file to your Android Studio Project

191

Page 192: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 1. Select Project View

192

Page 193: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 2. Drag/Drop .jar file into libs directory

193

Page 194: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 3. Right-click on .jar file, select Add as Library

194

Page 195: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 4. Confirm Results

195

Page 196: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 5. Confirm gradle

196

Page 197: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Step 5. Confirm In MainActivity

197

Page 198: Android 5 Lollipop Development Tools - SDJUG · • The Bad News for Eclipse Users: You may be using Eclipse for other software development projects (Android, C/C++, PHP, etc) and

Copyright (c) 2015 Servin Corp

Thank You!

198