1 00:00:00,210 --> 00:00:03,250 There's one very important thing we haven't talked about yet. 2 00:00:03,250 --> 00:00:06,290 So far, we have only run the app in the emulator. 3 00:00:06,290 --> 00:00:08,430 But how do we run it on a phone? 4 00:00:08,430 --> 00:00:09,890 It's usually pretty easy. 5 00:00:09,890 --> 00:00:13,600 But it does depend on your phone and the computer you're using. 6 00:00:13,600 --> 00:00:17,700 Even if you don't have a phone to test on, this will still be useful to know. 7 00:00:17,700 --> 00:00:20,310 On a Mac, PC, or Linux computer, 8 00:00:20,310 --> 00:00:24,770 start by just connecting your phone to the computer with a USB cable. 9 00:00:24,770 --> 00:00:28,690 You may need to disconnect the USB cable from your charging adapter. 10 00:00:28,690 --> 00:00:32,750 If you're using a Windows or Linux computer, this is where it can get tricky. 11 00:00:32,750 --> 00:00:35,500 You need the appropriate device drivers for your phone. 12 00:00:35,500 --> 00:00:39,560 Some standard drivers are included in the Android development bundle we're using. 13 00:00:39,560 --> 00:00:42,200 But in some cases, you'll be prompted to download and 14 00:00:42,200 --> 00:00:44,950 install the drivers when you connect your phone. 15 00:00:44,950 --> 00:00:49,140 Or you might need to visit the website of the manufacturer to get the right drivers. 16 00:00:49,140 --> 00:00:52,130 Or maybe you've already installed some software that includes the necessary 17 00:00:52,130 --> 00:00:53,210 drivers. 18 00:00:53,210 --> 00:00:56,240 Each device is different, and sometimes it can be tricky. 19 00:00:56,240 --> 00:00:58,590 But if you have any trouble, check the community or 20 00:00:58,590 --> 00:01:02,380 Google how to connect your specific device for Android apps. 21 00:01:02,380 --> 00:01:05,650 I'll also post some helpful notes in the teacher's notes on this page. 22 00:01:07,100 --> 00:01:11,460 There's a special place in Android studio that shows us all of our connected devices 23 00:01:11,460 --> 00:01:12,880 including our emulator. 24 00:01:12,880 --> 00:01:16,567 It's down here in the bottom pane at the top left of the Logcat tab. 25 00:01:17,650 --> 00:01:21,420 It should show the phone or tablet you've just connected and maybe the emulator too. 26 00:01:22,490 --> 00:01:26,840 If your device isn't listed here, then you may need to enable USB debugging. 27 00:01:26,840 --> 00:01:28,820 Let's take a quick look at how to step that up. 28 00:01:30,170 --> 00:01:33,211 On your phone or tablet, go into the Android Settings page. 29 00:01:35,080 --> 00:01:40,900 Then scroll all the way to the bottom, and open the About phone section. 30 00:01:40,900 --> 00:01:43,020 In my case, it says About emulated device. 31 00:01:44,580 --> 00:01:48,700 Then scroll down to the bottom again, and tap seven times on the Build number. 32 00:01:50,170 --> 00:01:51,860 In my case, I've already done this. 33 00:01:52,880 --> 00:01:56,410 But once you click seven times, it will turn on the developer option section. 34 00:01:57,810 --> 00:02:01,200 So you can go back and open the developer option section. 35 00:02:02,240 --> 00:02:07,598 Once in here, you can scroll down to USB debugging, And 36 00:02:07,598 --> 00:02:08,664 make sure that it's turned on. 37 00:02:10,973 --> 00:02:15,090 You might get a notification on the phone that USB debugging is now activated. 38 00:02:16,130 --> 00:02:17,590 If your device is listed here, 39 00:02:17,590 --> 00:02:21,650 like mine is, that means you're ready to run apps on your device. 40 00:02:21,650 --> 00:02:24,170 We can run our app using the same run button or 41 00:02:24,170 --> 00:02:26,100 keyboard shortcuts that we've been using. 42 00:02:26,100 --> 00:02:29,680 However, if you've checked the check box to use the same device for 43 00:02:29,680 --> 00:02:35,490 future launches, you'll want to come in here, choose Edit Configurations, 44 00:02:35,490 --> 00:02:39,860 and then uncheck this check box, and then hit OK. 45 00:02:41,990 --> 00:02:46,030 Now, when you try to run the app, you'll get the device chooser, and 46 00:02:46,030 --> 00:02:49,610 you can pick your own device instead of the emulator. 47 00:02:49,610 --> 00:02:52,900 So select the device you connected and click OK to launch the app. 48 00:02:54,930 --> 00:02:56,820 And I'll choose to Proceed without Instant Run. 49 00:02:59,060 --> 00:03:02,270 Once the app loads, we should see some information here in Logcat. 50 00:03:03,520 --> 00:03:07,090 And if we look to the top left, we can see that it's running on our device. 51 00:03:08,280 --> 00:03:09,840 We can also click on this Run tab. 52 00:03:11,410 --> 00:03:14,940 And we can see information about how the app was loaded onto the device. 53 00:03:18,160 --> 00:03:21,600 If there were any problems, you may see some errors here on the Run tab. 54 00:03:23,030 --> 00:03:28,310 The app should start automatically on the phone, and success. 55 00:03:28,310 --> 00:03:30,670 Now, you can show off your app to your friends and family.