1
00:00:00,252 --> 00:00:02,671
(music)

2
00:00:02,671 --> 00:00:05,300
(typing)

3
00:00:05,300 --> 00:00:06,760
In the previous video,

4
00:00:06,760 --> 00:00:08,050
you saw how to run the app,

5
00:00:08,050 --> 00:00:08,883
the Hello World app,

6
00:00:08,883 --> 00:00:10,240
on an emulator.

7
00:00:10,240 --> 00:00:11,370
In this video,

8
00:00:11,370 --> 00:00:13,290
I'm gonna connect a real Android device,

9
00:00:13,290 --> 00:00:16,440
my own Android Nexus 5x phone

10
00:00:16,440 --> 00:00:18,290
and run our app on that.

11
00:00:18,290 --> 00:00:19,840
Now, if you're using Windows,

12
00:00:19,840 --> 00:00:21,080
it is important that you instal

13
00:00:21,080 --> 00:00:23,434
the Google USB driver,

14
00:00:23,434 --> 00:00:27,640
when we configured Android Studio using the SDK manager

15
00:00:27,640 --> 00:00:29,784
in the earlier video in section two.

16
00:00:29,784 --> 00:00:32,630
In addition, depending on the model of phone,

17
00:00:32,630 --> 00:00:33,860
you may need to instal

18
00:00:33,860 --> 00:00:37,460
download and instal a specific driver for your phone.

19
00:00:37,460 --> 00:00:39,009
That's only if you're running on Windows.

20
00:00:39,009 --> 00:00:41,030
Now, on a Mac or Linux machine,

21
00:00:41,030 --> 00:00:44,210
however, you can just plug the device in and it all works.

22
00:00:44,210 --> 00:00:45,043
So, that's a bit easy.

23
00:00:45,043 --> 00:00:47,010
We're now gonna be doing this on my Mac.

24
00:00:47,010 --> 00:00:49,210
So, I'm going to assume that in the case of Windows,

25
00:00:49,210 --> 00:00:51,340
you've got the necessary drivers installed

26
00:00:51,340 --> 00:00:53,380
and you can connect your phone to your computer

27
00:00:53,380 --> 00:00:56,385
using a USB cable to transfer files.

28
00:00:56,385 --> 00:00:58,247
Now if you have any problems doing that,

29
00:00:58,247 --> 00:01:00,380
then you do need to resolve them before

30
00:01:00,380 --> 00:01:02,350
continuing with this video.

31
00:01:02,350 --> 00:01:04,180
Samsung phones for Windows, for example,

32
00:01:04,180 --> 00:01:06,360
need KIES, K-I-E-S,

33
00:01:06,360 --> 00:01:07,710
installed on Windows,

34
00:01:07,710 --> 00:01:09,710
or certainly did at the time I'm recording this video.

35
00:01:09,710 --> 00:01:12,591
So do check if you're running on Windows,

36
00:01:12,591 --> 00:01:14,390
if there's specific software drivers needed

37
00:01:14,390 --> 00:01:17,730
for your Android device to communicate with Windows.

38
00:01:17,730 --> 00:01:18,680
All right, so that's set.

39
00:01:18,680 --> 00:01:21,410
The first thing to check before using your phone

40
00:01:21,410 --> 00:01:22,610
to run your apps on,

41
00:01:22,610 --> 00:01:24,650
is to make sure that you can transfer files

42
00:01:24,650 --> 00:01:26,160
from the phone or tablet.

43
00:01:26,160 --> 00:01:27,200
Now, if you can't do that,

44
00:01:27,200 --> 00:01:30,190
then anything else we try to do isn't going to work.

45
00:01:30,190 --> 00:01:32,310
Now, some phones come with USB cables

46
00:01:32,310 --> 00:01:33,890
that are for charging only

47
00:01:33,890 --> 00:01:35,500
that don't allow data transfer.

48
00:01:35,500 --> 00:01:37,110
And if you got problems copying photos,

49
00:01:37,110 --> 00:01:39,600
for example, from your phone to your computer,

50
00:01:39,600 --> 00:01:41,650
then do try a different cable.

51
00:01:41,650 --> 00:01:43,300
We have seen problems in the past that

52
00:01:43,300 --> 00:01:44,840
can be resolved with a new cable,

53
00:01:44,840 --> 00:01:46,770
so certainly if you're having issues,

54
00:01:46,770 --> 00:01:49,150
do try using a separate cable.

55
00:01:49,150 --> 00:01:51,130
Now, if you've got phone transfer working,

56
00:01:51,130 --> 00:01:54,497
let's get started running apps on a real device.

57
00:01:54,497 --> 00:01:56,680
Now, I've got some software that I'm about to

58
00:01:56,680 --> 00:01:59,570
start on my phone that lets me record the phone screen

59
00:01:59,570 --> 00:02:02,030
so that I can show you what's happening on my phone

60
00:02:02,030 --> 00:02:04,790
as well as what's happening in Android Studio.

61
00:02:04,790 --> 00:02:06,686
So, I'm going to switch over to the phone now,

62
00:02:06,686 --> 00:02:08,106
start the recording,

63
00:02:08,106 --> 00:02:11,613
and allow you to see what's actually going on on my phone.

64
00:02:14,200 --> 00:02:16,260
All right, so now you can see that my screen,

65
00:02:16,260 --> 00:02:17,583
my Nexus 5x screen is showing

66
00:02:17,583 --> 00:02:20,520
and what we're going to do is enable

67
00:02:20,520 --> 00:02:23,360
the developer options on this phone.

68
00:02:23,360 --> 00:02:25,160
Now, developer options aren't in any of

69
00:02:25,160 --> 00:02:26,880
the normal settings menus.

70
00:02:26,880 --> 00:02:29,640
Instead, they're actually hidden until you enable them.

71
00:02:29,640 --> 00:02:34,640
And in my case, we go into settings to actually do that.

72
00:02:34,640 --> 00:02:36,920
So we're gonna come down here,

73
00:02:36,920 --> 00:02:37,823
go into my settings,

74
00:02:39,530 --> 00:02:41,540
and this may be slightly different

75
00:02:41,540 --> 00:02:42,950
depending on the phone that you're running,

76
00:02:42,950 --> 00:02:44,994
but in the case of the Google Nexus 5x,

77
00:02:44,994 --> 00:02:47,290
I scroll down to the bottom, okay?

78
00:02:47,290 --> 00:02:49,480
So once I'm on this settings menu

79
00:02:49,480 --> 00:02:51,500
I'm gonna click on System in my case.

80
00:02:51,500 --> 00:02:52,890
So it'll be something along the lines of

81
00:02:52,890 --> 00:02:53,920
Settings, About phone.

82
00:02:53,920 --> 00:02:57,590
You need to get to the menu that has the About phone option.

83
00:02:57,590 --> 00:02:59,780
So I'm gonna click on System in my case.

84
00:02:59,780 --> 00:03:00,880
You can see down on the bottom here,

85
00:03:00,880 --> 00:03:02,720
I've got About phone.

86
00:03:02,720 --> 00:03:03,673
And what I can do there now,

87
00:03:03,673 --> 00:03:05,117
is I can actually click on that

88
00:03:05,117 --> 00:03:09,290
and that brings us to this About phone option.

89
00:03:09,290 --> 00:03:10,950
Now just before I scroll down to the bottom

90
00:03:10,950 --> 00:03:12,420
I'm gonna hit this build number.

91
00:03:12,420 --> 00:03:13,950
Do note that this option here hasn't

92
00:03:13,950 --> 00:03:16,150
got a developer's menu option at the moment.

93
00:03:16,150 --> 00:03:17,650
So what this means is that it's not enabled.

94
00:03:17,650 --> 00:03:18,770
So in the case of my phone,

95
00:03:18,770 --> 00:03:20,560
this is where that menu will appear.

96
00:03:20,560 --> 00:03:22,000
So I go into About phone,

97
00:03:22,000 --> 00:03:23,810
and you'll need to find that for your device.

98
00:03:23,810 --> 00:03:25,870
You get down here and scroll down to the bottom

99
00:03:25,870 --> 00:03:28,310
we got this build number as you can see here.

100
00:03:28,310 --> 00:03:33,310
So, what we need to do is actually tap that seven times.

101
00:03:33,370 --> 00:03:34,203
When you do that,

102
00:03:34,203 --> 00:03:35,480
you'll get a message that developer options

103
00:03:35,480 --> 00:03:36,313
have been enabled.

104
00:03:36,313 --> 00:03:39,170
And it's not very intuitive, but that's deliberate.

105
00:03:39,170 --> 00:03:41,423
So it prevents people from turning developer options on

106
00:03:41,423 --> 00:03:43,850
without knowing what they are or what they're for.

107
00:03:43,850 --> 00:03:47,210
And in the case of using an Android device for testing,

108
00:03:47,210 --> 00:03:49,420
we need to have that developer's option.

109
00:03:49,420 --> 00:03:51,820
So, I'm gonna tap this build number seven times.

110
00:03:53,640 --> 00:03:56,080
And notice that we've got a menu (mumbles)

111
00:03:56,080 --> 00:03:57,540
popping up there now.

112
00:03:57,540 --> 00:03:59,910
And on the phone we've got this message here,

113
00:03:59,910 --> 00:04:02,290
and because I'm using the Google Nexus 5x,

114
00:04:02,290 --> 00:04:04,122
I've got a pattern that I can specify

115
00:04:04,122 --> 00:04:05,610
to unlock this phone,

116
00:04:05,610 --> 00:04:07,012
but if you'll use,

117
00:04:07,012 --> 00:04:09,210
you might have a pin or some other mechanism

118
00:04:09,210 --> 00:04:10,750
to unlock the phone at this point.

119
00:04:10,750 --> 00:04:12,900
So I'm just gonna unlock this and continue.

120
00:04:16,640 --> 00:04:18,140
And now you can see that it says down there

121
00:04:18,140 --> 00:04:20,230
at the bottom that you are now a developer.

122
00:04:20,230 --> 00:04:22,700
So basically, tapping the build number seven times

123
00:04:22,700 --> 00:04:24,270
turns on the developer options

124
00:04:24,270 --> 00:04:26,610
and lets you use the phone for development purposes,

125
00:04:26,610 --> 00:04:29,130
which we want to do in this course.

126
00:04:29,130 --> 00:04:31,150
So you now should have a new menu on your phone

127
00:04:31,150 --> 00:04:32,590
it should either be in this menu here

128
00:04:32,590 --> 00:04:34,005
or if we go back one,

129
00:04:34,005 --> 00:04:36,360
you can see now that we've got this menu

130
00:04:36,360 --> 00:04:38,350
Developer options showing on the screen now,

131
00:04:38,350 --> 00:04:40,140
which wasn't there before.

132
00:04:40,140 --> 00:04:41,620
So your first challenge on this course,

133
00:04:41,620 --> 00:04:43,244
is if you're not running a Google Nexus 5x,

134
00:04:43,244 --> 00:04:45,990
is to find that menu on your phone.

135
00:04:45,990 --> 00:04:46,970
So in my case you can see it's there.

136
00:04:46,970 --> 00:04:49,413
So I'm gonna click on Developer options.

137
00:04:50,527 --> 00:04:52,730
Now there's a host of options in the

138
00:04:52,730 --> 00:04:54,179
Developer options menu.

139
00:04:54,179 --> 00:04:55,720
But we're only really interested

140
00:04:55,720 --> 00:04:57,130
in two of them at this stage.

141
00:04:57,130 --> 00:04:59,210
And only one is really important.

142
00:04:59,210 --> 00:05:01,120
Now the first one, is Stay Awake,

143
00:05:01,120 --> 00:05:03,285
you can see that on the screen there.

144
00:05:03,285 --> 00:05:05,360
And this prevents the phone from locking

145
00:05:05,360 --> 00:05:06,560
while it's charging.

146
00:05:06,560 --> 00:05:08,200
So you won't have to keep unlocking it

147
00:05:08,200 --> 00:05:09,730
while testing your app.

148
00:05:09,730 --> 00:05:11,370
It saves a bit of time and annoyance,

149
00:05:11,370 --> 00:05:13,570
but if you don't have that option then don't worry,

150
00:05:13,570 --> 00:05:14,403
but if you do have it,

151
00:05:14,403 --> 00:05:16,160
then it might be a good idea to tick it

152
00:05:16,160 --> 00:05:17,710
and that's if you have something like a password

153
00:05:17,710 --> 00:05:18,990
or pattern, as in my case,

154
00:05:18,990 --> 00:05:20,010
to unlock your phone.

155
00:05:20,010 --> 00:05:21,870
So I'm gonna select that anyway

156
00:05:21,870 --> 00:05:22,900
to leave it on,

157
00:05:22,900 --> 00:05:25,340
so that it will never sleep while charging

158
00:05:25,340 --> 00:05:28,445
so that it just saves us a bit of time during our testing.

159
00:05:28,445 --> 00:05:31,720
But the important setting is USB debugging.

160
00:05:31,720 --> 00:05:34,020
So I need to scroll down a little to see that.

161
00:05:35,078 --> 00:05:35,930
So there's USB debugging,

162
00:05:35,930 --> 00:05:37,810
the debugging menu there.

163
00:05:37,810 --> 00:05:38,810
Now without this one setting,

164
00:05:38,810 --> 00:05:40,900
you won't be able to test apps on your device

165
00:05:40,900 --> 00:05:42,280
from Android Studio.

166
00:05:42,280 --> 00:05:44,860
So you need to make sure you turn on USB debugging.

167
00:05:44,860 --> 00:05:46,060
So I'm going to do that.

168
00:05:47,277 --> 00:05:48,300
And you can see we've got this pop-up,

169
00:05:48,300 --> 00:05:50,730
and you'll probably get a similar message on your phone.

170
00:05:50,730 --> 00:05:52,660
And it's asking us to confirm that

171
00:05:52,660 --> 00:05:54,300
we want to allow USB debugging.

172
00:05:54,300 --> 00:05:55,390
In this case that's fine,

173
00:05:55,390 --> 00:05:57,620
because we are using it for development purposes.

174
00:05:57,620 --> 00:05:59,620
I'm gonna click on OK.

175
00:05:59,620 --> 00:06:00,860
So once that's done,

176
00:06:00,860 --> 00:06:03,200
you want to plug one end of the USB cable into the phone

177
00:06:03,200 --> 00:06:05,490
and the other into the computer.

178
00:06:05,490 --> 00:06:07,200
So I'm gonna stay on my phone display,

179
00:06:07,200 --> 00:06:09,920
insert that now and plug my device in.

180
00:06:09,920 --> 00:06:10,813
And just before that,

181
00:06:10,813 --> 00:06:13,370
what I'm gonna do is switch back to Android Studio

182
00:06:13,370 --> 00:06:15,000
and I wanna bring up the screen

183
00:06:15,000 --> 00:06:17,176
where we normally start our app.

184
00:06:17,176 --> 00:06:18,009
So I'm gonna come back to there now

185
00:06:19,456 --> 00:06:21,006
I'm gonna click on the Run menu

186
00:06:22,030 --> 00:06:24,107
and you can see here on the list of connected devices

187
00:06:24,107 --> 00:06:25,990
at the moment there's nothing.

188
00:06:25,990 --> 00:06:28,250
There's only the virtual device that

189
00:06:28,250 --> 00:06:30,120
we previously configured that we run our app in

190
00:06:30,120 --> 00:06:31,420
in the last video,

191
00:06:31,420 --> 00:06:32,450
there's nothing under connected devices.

192
00:06:32,450 --> 00:06:33,920
We're gonna come back to that shortly,

193
00:06:33,920 --> 00:06:35,470
but for now, we're going back to

194
00:06:35,470 --> 00:06:37,400
the screen on my phone again.

195
00:06:37,400 --> 00:06:38,800
I'm gonna plug in the cable,

196
00:06:41,080 --> 00:06:43,197
and I've now got this message on my phone that says

197
00:06:43,197 --> 00:06:44,850
"Allow USB debugging?"

198
00:06:44,850 --> 00:06:47,210
And it's giving me the message about the computer's

199
00:06:47,210 --> 00:06:48,620
RSA key fingerprint,

200
00:06:48,620 --> 00:06:51,840
which I have to a bit obscure for security reasons,

201
00:06:51,840 --> 00:06:53,608
but it's just basically a large number.

202
00:06:53,608 --> 00:06:56,103
It's asking us whether we want to allow that.

203
00:06:56,103 --> 00:06:58,477
When I switch back to Android Studio quickly,

204
00:06:58,477 --> 00:07:01,429
you can see at the moment under connected devices

205
00:07:01,429 --> 00:07:04,659
is a code there that says offline at the moment.

206
00:07:04,659 --> 00:07:06,553
So what I'm gonna do now,

207
00:07:06,553 --> 00:07:08,460
I'll switch back to my phone's display,

208
00:07:08,460 --> 00:07:10,850
is I'm going to click on Always allow from this computer.

209
00:07:10,850 --> 00:07:13,503
'Cause this is gonna be my main test computer.

210
00:07:13,503 --> 00:07:15,450
And I'm gonna click on OK,

211
00:07:15,450 --> 00:07:16,940
and once we do that we'll switch back over

212
00:07:16,940 --> 00:07:18,280
to Android Studio.

213
00:07:18,280 --> 00:07:19,343
Clicked on OK there,

214
00:07:20,290 --> 00:07:22,490
and now if we switch back to Android Studio,

215
00:07:22,490 --> 00:07:23,833
you can see under connected devices

216
00:07:23,833 --> 00:07:25,656
this LGE Nexus 5x,

217
00:07:25,656 --> 00:07:28,360
and that'll be your phone's model

218
00:07:28,360 --> 00:07:30,290
and it tells you also the API that is running

219
00:07:30,290 --> 00:07:31,730
and in my case I'm running the Android 8

220
00:07:31,730 --> 00:07:33,810
on this phone, API 26.

221
00:07:33,810 --> 00:07:36,920
I've now got a device that we can actually test on.

222
00:07:36,920 --> 00:07:37,950
So basically what we've done is

223
00:07:37,950 --> 00:07:40,010
we've set up the phone and allowed it,

224
00:07:40,010 --> 00:07:40,930
or given it access,

225
00:07:40,930 --> 00:07:43,890
so that we can use it to run applications to test.

226
00:07:43,890 --> 00:07:46,243
And again, with the deployment target on

227
00:07:46,243 --> 00:07:48,760
you can see that we've got this Nexus 5X

228
00:07:48,760 --> 00:07:49,850
available as an option now,

229
00:07:49,850 --> 00:07:51,720
which wasn't there before.

230
00:07:51,720 --> 00:07:53,610
And we've still got our available virtual device,

231
00:07:53,610 --> 00:07:55,540
which we're running the emulator,

232
00:07:55,540 --> 00:07:57,280
but we've now got a real device as well,

233
00:07:57,280 --> 00:07:59,210
which we're going to be using to run now.

234
00:07:59,210 --> 00:08:01,990
So you can use the same mechanism as I've used before.

235
00:08:01,990 --> 00:08:04,840
You can just come up here and select Run.

236
00:08:04,840 --> 00:08:07,360
And choose either the connected device

237
00:08:07,360 --> 00:08:10,288
and just if I unplug the USB cable now,

238
00:08:10,288 --> 00:08:11,121
that's what I'm doing now,

239
00:08:11,121 --> 00:08:13,040
you can see that then disappears.

240
00:08:13,040 --> 00:08:14,090
Connected devices now.

241
00:08:14,090 --> 00:08:15,440
If I plug it back in again,

242
00:08:17,093 --> 00:08:18,380
give it a moment,

243
00:08:18,380 --> 00:08:19,740
you can see that it actually comes back again.

244
00:08:19,740 --> 00:08:21,655
So once you have done that one time configuration,

245
00:08:21,655 --> 00:08:23,510
you'll be able to access this

246
00:08:23,510 --> 00:08:24,720
without going into any menus

247
00:08:24,720 --> 00:08:26,120
or setting anything else up.

248
00:08:27,490 --> 00:08:29,050
Keep in mind that if you're running on Windows,

249
00:08:29,050 --> 00:08:31,490
you should probably also disconnect the device properly

250
00:08:31,490 --> 00:08:32,710
from the task bar,

251
00:08:32,710 --> 00:08:34,340
as you would like a USB memory stick

252
00:08:34,340 --> 00:08:35,850
or something along those lines.

253
00:08:35,850 --> 00:08:38,360
But obviously in my case, on a Mac,

254
00:08:38,360 --> 00:08:40,450
I haven't done anything to the phone's storage.

255
00:08:40,450 --> 00:08:41,990
I haven't written any data to the phone.

256
00:08:41,990 --> 00:08:43,940
So it was okay just to unplug it.

257
00:08:43,940 --> 00:08:45,320
Now if your phone doesn't appear

258
00:08:45,320 --> 00:08:48,638
or you can't see its full name or the serial number,

259
00:08:48,638 --> 00:08:50,025
that probably means that you haven't ticked

260
00:08:50,025 --> 00:08:52,413
the USB debugging in the developer's options

261
00:08:52,413 --> 00:08:54,780
that I showed you earlier in this video,

262
00:08:54,780 --> 00:08:57,513
or you haven't allowed access from your computer.

263
00:08:57,513 --> 00:08:59,090
In my case let's actually try running this.

264
00:08:59,090 --> 00:09:01,890
I'm gonna click on OK to start it running

265
00:09:01,890 --> 00:09:03,591
and then I'm gonna switch back to

266
00:09:03,591 --> 00:09:04,690
my Google Nexus 5x phone

267
00:09:04,690 --> 00:09:05,930
and check that it works.

268
00:09:05,930 --> 00:09:07,250
Clicking on OK,

269
00:09:07,250 --> 00:09:08,723
I go back to the phone now,

270
00:09:10,336 --> 00:09:11,709
and you can see that on my phone

271
00:09:11,709 --> 00:09:14,330
the app was launched automatically

272
00:09:14,330 --> 00:09:15,790
and we've got the Hello World application

273
00:09:15,790 --> 00:09:18,103
now running on my Google Nexus 5x.

274
00:09:20,006 --> 00:09:22,420
Now by the way, you don't need to be running Oreo,

275
00:09:22,420 --> 00:09:23,890
API 26, on your phone,

276
00:09:23,890 --> 00:09:26,818
as long as your phone is running API 17 or higher,

277
00:09:26,818 --> 00:09:28,587
then the app should work.

278
00:09:28,587 --> 00:09:30,706
And if your phone isn't running

279
00:09:30,706 --> 00:09:33,456
at at least the minimum SDK that we set,

280
00:09:33,456 --> 00:09:34,780
you'll get a message when you select the device

281
00:09:34,780 --> 00:09:35,877
and click OK.

282
00:09:35,877 --> 00:09:38,550
And in fact looking at the slide here,

283
00:09:38,550 --> 00:09:41,073
you'll see that there was actually an indication of this

284
00:09:41,073 --> 00:09:43,873
in the phone's description before clicking OK.

285
00:09:43,873 --> 00:09:45,880
So again, your phone needs to be running the

286
00:09:45,880 --> 00:09:49,059
minimum SDK that we set, which was API 17,

287
00:09:49,059 --> 00:09:51,273
when we configured this project.

288
00:09:52,385 --> 00:09:55,030
Now if that's the only physical device you've got,

289
00:09:55,030 --> 00:09:56,580
you can change the minimum SDK.

290
00:09:57,798 --> 00:09:59,117
You can go into File,

291
00:09:59,117 --> 00:09:59,950
Project Structure,

292
00:09:59,950 --> 00:10:00,783
Hit File,

293
00:10:00,783 --> 00:10:02,141
Project Structure,

294
00:10:02,141 --> 00:10:04,850
(clicks)

295
00:10:04,850 --> 00:10:06,450
and then click on App down here.

296
00:10:08,150 --> 00:10:10,750
And you can see we've got, on the Flavours tab,

297
00:10:10,750 --> 00:10:12,610
come over here to Flavours,

298
00:10:12,610 --> 00:10:14,066
we've got minimum SDK version

299
00:10:14,066 --> 00:10:16,710
and you can change that to match the version of

300
00:10:16,710 --> 00:10:18,340
Android running on your phone.

301
00:10:18,340 --> 00:10:20,235
We can select that.

302
00:10:20,235 --> 00:10:21,270
And actually it doesn't really matter

303
00:10:21,270 --> 00:10:22,420
what is available in the drop-down

304
00:10:22,420 --> 00:10:24,370
because what you can actually do is

305
00:10:24,370 --> 00:10:25,990
you can just type the API number

306
00:10:25,990 --> 00:10:27,970
that you want to set into the box.

307
00:10:27,970 --> 00:10:28,803
So, for example,

308
00:10:28,803 --> 00:10:30,817
if you're using an API 16 device,

309
00:10:30,817 --> 00:10:33,930
you can change the 17 to a 16 just by typing it.

310
00:10:33,930 --> 00:10:36,403
Click OK and the project updates.

311
00:10:39,210 --> 00:10:41,613
You can see here on the bottom (mumbles) was working away.

312
00:10:42,780 --> 00:10:43,613
And from that point,

313
00:10:43,613 --> 00:10:46,430
when you go to run it again after you've finished updating,

314
00:10:46,430 --> 00:10:48,510
you'll be able to run that on your phone,

315
00:10:48,510 --> 00:10:50,410
assuming in this particular case,

316
00:10:50,410 --> 00:10:52,443
it was an API 16 device.

317
00:10:53,356 --> 00:10:54,900
In the case of what we did,

318
00:10:54,900 --> 00:10:56,880
I'm just gonna go back and make that change again.

319
00:10:56,880 --> 00:10:58,929
Go back into Project Structure,

320
00:10:58,929 --> 00:11:00,910
App, click on Flavours,

321
00:11:00,910 --> 00:11:02,540
I'm gonna set it back to what it was,

322
00:11:02,540 --> 00:11:03,624
which was in my case,

323
00:11:03,624 --> 00:11:05,784
17 being the minimum version that we defined

324
00:11:05,784 --> 00:11:07,593
at the start of this project.

325
00:11:08,830 --> 00:11:09,760
So this example,

326
00:11:09,760 --> 00:11:12,279
as long as your phone is running API 17 or higher,

327
00:11:12,279 --> 00:11:13,840
it should work fine.

328
00:11:13,840 --> 00:11:16,226
If not, you'll just need to change the minimum SDK level,

329
00:11:16,226 --> 00:11:17,854
as you saw me do there.

330
00:11:17,854 --> 00:11:22,490
But with 96% of devices now running API 17 or higher,

331
00:11:22,490 --> 00:11:24,500
it should be fine in most cases.

332
00:11:24,500 --> 00:11:25,333
So that's it,

333
00:11:25,333 --> 00:11:26,550
that's how to run an app on your phone

334
00:11:26,550 --> 00:11:28,200
rather than using an emulator.

335
00:11:28,200 --> 00:11:29,440
So it's running fine as you saw

336
00:11:29,440 --> 00:11:32,917
and I'll go back now briefly to the phone now

337
00:11:32,917 --> 00:11:35,930
and if I actually were to take this into landscape,

338
00:11:35,930 --> 00:11:37,660
so I've moved the phone,

339
00:11:37,660 --> 00:11:40,140
you can see the app successfully changes

340
00:11:40,140 --> 00:11:41,344
to landscape automatically.

341
00:11:41,344 --> 00:11:42,590
So that's it.

342
00:11:42,590 --> 00:11:44,630
How to run an app on your physical device.

343
00:11:44,630 --> 00:11:46,470
So as long as you've enabled Developer options

344
00:11:46,470 --> 00:11:48,800
by tapping seven times as you saw me do,

345
00:11:48,800 --> 00:11:51,390
you can turn USB debugging on whenever

346
00:11:51,390 --> 00:11:53,270
you want to use your phone to test your apps.

347
00:11:53,270 --> 00:11:54,630
And you may want to switch off

348
00:11:54,630 --> 00:11:56,120
USB debugging when you're done,

349
00:11:56,120 --> 00:11:57,910
just remember to turn it on again

350
00:11:57,910 --> 00:11:59,690
when you come back to developing on it.

351
00:11:59,690 --> 00:12:01,816
But there's nothing wrong with leaving USB debugging on

352
00:12:01,816 --> 00:12:03,500
if that's something you want to do

353
00:12:03,500 --> 00:12:05,610
and you're testing on a regular basis.

354
00:12:05,610 --> 00:12:07,430
All right, so that's the end of this section.

355
00:12:07,430 --> 00:12:08,380
In the next section,

356
00:12:08,380 --> 00:12:11,002
we're going to start creating proper applications

357
00:12:11,002 --> 00:12:13,440
and I'm gonna be explaining some of the concepts

358
00:12:13,440 --> 00:12:15,010
like main activity and layouts

359
00:12:15,010 --> 00:12:17,080
and so forth in more detail.

360
00:12:17,080 --> 00:12:18,680
We haven't done any programming yet,

361
00:12:18,680 --> 00:12:20,750
but we've now got the development environment set up

362
00:12:20,750 --> 00:12:21,660
and we can now run apps

363
00:12:21,660 --> 00:12:23,620
using emulators and physical devices.

364
00:12:23,620 --> 00:12:24,993
So, we're ready to start.

