1
00:00:00,040 --> 00:00:02,070
- Before creating your first Android Studio

2
00:00:02,070 --> 00:00:04,070
project, you'll need to make sure

3
00:00:04,070 --> 00:00:07,000
you've set up some basic software.

4
00:00:07,000 --> 00:00:09,040
As I've described previously, you'll need

5
00:00:09,040 --> 00:00:13,000
the Java Development Kit, or JDK, from Oracle.

6
00:00:13,000 --> 00:00:17,000
You also need to have installed and updated Android Studio.

7
00:00:17,000 --> 00:00:19,030
If you haven't gone through these steps yet,

8
00:00:19,030 --> 00:00:21,050
stop watching this video, and go back to the

9
00:00:21,050 --> 00:00:25,070
previous videos that describe how to set up the software.

10
00:00:25,070 --> 00:00:29,070
In this course, I'm using Android Studio 1.4,

11
00:00:29,070 --> 00:00:33,040
and I'm working with the version of the SDK

12
00:00:33,040 --> 00:00:36,070
for Android 6.0, or Marshmallow,

13
00:00:36,070 --> 00:00:41,050
which is known for the developer as API level 23.

14
00:00:41,050 --> 00:00:44,010
To create your first app, start in the

15
00:00:44,010 --> 00:00:46,050
Android Studio welcome screen,

16
00:00:46,050 --> 00:00:50,010
and click Start a New Android Studio Project.

17
00:00:50,010 --> 00:00:54,000
I'm going to name my application Hello World,

18
00:00:54,000 --> 00:00:55,090
and then I'll set the company domain

19
00:00:55,090 --> 00:00:59,020
starting with example.com.

20
00:00:59,020 --> 00:01:01,030
Any app that belongs to this particular

21
00:01:01,030 --> 00:01:05,030
domain can't be submitted to the Google Play Store,

22
00:01:05,030 --> 00:01:07,050
and so by using this, I'll make sure that

23
00:01:07,050 --> 00:01:10,080
it's always marked as a sample application.

24
00:01:10,080 --> 00:01:13,000
But my particular app is going to be

25
00:01:13,000 --> 00:01:15,020
a clothing catalogue for a fictional

26
00:01:15,020 --> 00:01:18,080
company named H Plus Sport, so I'm going to set

27
00:01:18,080 --> 00:01:24,000
the complete company name as hsport.example.com.

28
00:01:24,000 --> 00:01:26,030
That generates a package name,

29
00:01:26,030 --> 00:01:28,040
showed in dim characters below.

30
00:01:28,040 --> 00:01:30,020
The package name is also known as

31
00:01:30,020 --> 00:01:32,080
the app identifier, and it provides

32
00:01:32,080 --> 00:01:35,040
a global unique identity for the app,

33
00:01:35,040 --> 00:01:38,010
so only one app for each identity

34
00:01:38,010 --> 00:01:40,080
can be hosted on the Google Play Store

35
00:01:40,080 --> 00:01:43,090
or other distribution channels.

36
00:01:43,090 --> 00:01:46,000
If you like, you can customize the

37
00:01:46,000 --> 00:01:48,040
package name by clicking the Edit link,

38
00:01:48,040 --> 00:01:50,050
and I'm going to change my actual

39
00:01:50,050 --> 00:01:54,080
package name to hsport.catalog,

40
00:01:54,080 --> 00:01:56,070
and I'll use this same package name

41
00:01:56,070 --> 00:01:59,060
for all of the sample apps throughout this course,

42
00:01:59,060 --> 00:02:01,070
so that when I install a new app,

43
00:02:01,070 --> 00:02:04,080
it'll replace the old one on any particular device,

44
00:02:04,080 --> 00:02:06,040
and I won't end up with a whole bunch

45
00:02:06,040 --> 00:02:08,090
of different apps on the devices.

46
00:02:08,090 --> 00:02:12,030
Next I'll indicate where I'm creating my project on disk.

47
00:02:12,030 --> 00:02:16,020
The default is a folder named Android Studio Projects

48
00:02:16,020 --> 00:02:18,050
underneath my home folder.

49
00:02:18,050 --> 00:02:20,050
This is just a folder.

50
00:02:20,050 --> 00:02:23,030
It's not like an Eclipse workspace that contains

51
00:02:23,030 --> 00:02:25,050
configuration information.

52
00:02:25,050 --> 00:02:27,090
And if you prefer, you can place the project

53
00:02:27,090 --> 00:02:30,050
anywhere else on your hard disk.

54
00:02:30,050 --> 00:02:34,000
I'll Accept that location and click Next.

55
00:02:34,000 --> 00:02:38,050
On this screen, I'm asked what my Minimum SDK will be.

56
00:02:38,050 --> 00:02:42,020
The default is typically API 15,

57
00:02:42,020 --> 00:02:46,060
or Android 4.0.3 (IceCreamSandwich).

58
00:02:46,060 --> 00:02:50,030
If you want to support all of the current devices

59
00:02:50,030 --> 00:02:53,000
that are being tracked in the Google Play Store,

60
00:02:53,000 --> 00:02:55,050
you could instead choose API 8,

61
00:02:55,050 --> 00:02:58,090
for Android 2.2 or Froyo.

62
00:02:58,090 --> 00:03:02,000
But that would require a lot more development and testing

63
00:03:02,000 --> 00:03:03,020
on your part.

64
00:03:03,020 --> 00:03:06,020
You can click on this link to help you choose,

65
00:03:06,020 --> 00:03:08,040
but this information, in my experience,

66
00:03:08,040 --> 00:03:11,010
is usually a little bit out of date.

67
00:03:11,010 --> 00:03:13,060
To find better, more up-to-date information

68
00:03:13,060 --> 00:03:16,020
about current penetration statistics

69
00:03:16,020 --> 00:03:18,000
for different versions of Android,

70
00:03:18,000 --> 00:03:20,020
go to a browser.

71
00:03:20,020 --> 00:03:22,050
This is the screen where you can find out current usage

72
00:03:22,050 --> 00:03:25,010
rates on the Google Play Store.

73
00:03:25,010 --> 00:03:27,000
And you'll see that as of this date,

74
00:03:27,000 --> 00:03:30,030
Froyo has a tiny, tiny percentage of the market,

75
00:03:30,030 --> 00:03:33,060
and even Android 2.3, Gingerbread,

76
00:03:33,060 --> 00:03:35,090
has a very small percentage.

77
00:03:35,090 --> 00:03:38,070
If you eliminate support for these versions of Android,

78
00:03:38,070 --> 00:03:42,070
you can save yourself a lot of development and testing time.

79
00:03:42,070 --> 00:03:45,080
Also on this screen, you're asked which form factors,

80
00:03:45,080 --> 00:03:48,080
or what kind of devices you're going to support.

81
00:03:48,080 --> 00:03:53,040
The default is building an app for phone and tablet.

82
00:03:53,040 --> 00:03:57,000
And that's all I'm going to choose for my app.

83
00:03:57,000 --> 00:04:01,070
I'm not going to build apps for ware, TV, or Android Auto.

84
00:04:01,070 --> 00:04:05,040
So I'll set my minimum SDK to API 15,

85
00:04:05,040 --> 00:04:07,040
and click Next.

86
00:04:07,040 --> 00:04:10,000
By default, your app will have a single activity,

87
00:04:10,000 --> 00:04:11,060
or screen,

88
00:04:11,060 --> 00:04:13,060
and the default selection is a template named

89
00:04:13,060 --> 00:04:15,080
Blank Activity.

90
00:04:15,080 --> 00:04:18,000
This will create that Single Activity

91
00:04:18,000 --> 00:04:20,080
and it will display some simple text.

92
00:04:20,080 --> 00:04:24,000
It will also present a fairly sophisticated control

93
00:04:24,000 --> 00:04:26,040
called a Floating Action Button,

94
00:04:26,040 --> 00:04:30,030
and add Java code to react when the user presses the button.

95
00:04:30,030 --> 00:04:32,070
If you want to start with a much simpler app,

96
00:04:32,070 --> 00:04:35,030
choose the Empty Activity template

97
00:04:35,030 --> 00:04:38,000
and you'll only get a little bit of text.

98
00:04:38,000 --> 00:04:41,040
But I'll choose Blank Activity and click Next again.

99
00:04:41,040 --> 00:04:44,070
This screen asks for something called an Activity Name,

100
00:04:44,070 --> 00:04:47,030
and this will be the name of a Java class,

101
00:04:47,030 --> 00:04:50,070
and a related layout, which is an XML file

102
00:04:50,070 --> 00:04:54,010
that describes the appearance of this screen.

103
00:04:54,010 --> 00:04:55,070
There's also a title,

104
00:04:55,070 --> 00:04:59,000
and I'm going to change the Title to Hello World,

105
00:04:59,000 --> 00:05:00,090
and a Menu Resource Name,

106
00:05:00,090 --> 00:05:05,000
and this is an XML file that describes an Options menu.

107
00:05:05,000 --> 00:05:09,020
If you prefer, you can create your screen using a fragment,

108
00:05:09,020 --> 00:05:12,040
and this will let you easily adapt your application

109
00:05:12,040 --> 00:05:14,090
to tablets or other size devices.

110
00:05:14,090 --> 00:05:19,010
But I'll leave that option unchecked to keep things

111
00:05:19,010 --> 00:05:20,040
a little bit simpler,

112
00:05:20,040 --> 00:05:21,040
and I'll click Finish.

113
00:05:21,040 --> 00:05:23,060
That creates the project.

114
00:05:23,060 --> 00:05:26,020
When you see the Activity Design screen open and display

115
00:05:26,020 --> 00:05:27,080
the app's first screen,

116
00:05:27,080 --> 00:05:30,070
you're ready to run the app for the first time,

117
00:05:30,070 --> 00:05:32,080
but if this is the first time you've gone through this

118
00:05:32,080 --> 00:05:36,040
process, it might take awhile to get here.

119
00:05:36,040 --> 00:05:38,050
Down at the bottom of the screen,

120
00:05:38,050 --> 00:05:40,080
you'll see some messages indicating that content

121
00:05:40,080 --> 00:05:42,050
is being indexed,

122
00:05:42,050 --> 00:05:45,020
and this process can take a few minutes,

123
00:05:45,020 --> 00:05:47,010
so step away from the computer

124
00:05:47,010 --> 00:05:49,090
and then come back to it a little bit later.

125
00:05:49,090 --> 00:05:52,070
The next time you create a project,

126
00:05:52,070 --> 00:05:55,040
I promise it'll go a lot faster.

127
00:05:55,040 --> 00:05:57,090
Also, if you see any errors,

128
00:05:57,090 --> 00:06:00,060
once again wait for all that processing to finish

129
00:06:00,060 --> 00:06:02,080
before you try to fix it,

130
00:06:02,080 --> 00:06:04,090
but if you still see errors there,

131
00:06:04,090 --> 00:06:07,050
go to the menu and choose Build,

132
00:06:07,050 --> 00:06:10,030
and then Clean Project.

133
00:06:10,030 --> 00:06:13,030
And that will delete any artifacts that were initially

134
00:06:13,030 --> 00:06:16,080
created and completely rebuild the project

135
00:06:16,080 --> 00:06:20,020
and this will frequently fix any issues that appear

136
00:06:20,020 --> 00:06:22,090
the first time that you create the project.

137
00:06:22,090 --> 00:06:25,000
So now, you've created the app

138
00:06:25,000 --> 00:06:28,020
and you're ready to test it on a device.

139
00:06:28,020 --> 00:06:30,050
You'll need either a physical device that's configured

140
00:06:30,050 --> 00:06:33,070
for testing, or a virtual device that you can use

141
00:06:33,070 --> 00:06:35,060
in the Android emulator,

142
00:06:35,060 --> 00:06:38,030
and I'll describe how to get started with both options

143
00:06:38,030 --> 00:06:40,050
in the next couple of videos.

144
01:59:58,000 --> 01:59:59:000
-end-

