1 00:00:00,650 --> 00:00:04,200 If you already have the MusicMachine app as a project from an earlier course, 2 00:00:04,200 --> 00:00:06,570 then you may want to use that for this course. 3 00:00:06,570 --> 00:00:09,530 But you'll need a few things for some of these examples. 4 00:00:09,530 --> 00:00:13,100 I'd recommend starting with the version of the project I'm supplying here, but 5 00:00:13,100 --> 00:00:17,010 the starter code is available on GitHub if you want to copy new things as needed 6 00:00:17,010 --> 00:00:18,640 into your own project. 7 00:00:18,640 --> 00:00:22,090 With that said, check the links in teacher's notes for the starter files. 8 00:00:22,090 --> 00:00:25,430 Take a moment to download them or clone the project from GitHub and 9 00:00:25,430 --> 00:00:27,870 then we can walk through opening it up for the first time together. 10 00:00:30,170 --> 00:00:32,700 Importing a project can be kind of a headache 11 00:00:32,700 --> 00:00:35,900 when the Gradle settings have changed, which they often do. 12 00:00:35,900 --> 00:00:39,830 If nothing else follow along to see how to troubleshoot some common issues and 13 00:00:39,830 --> 00:00:42,340 if you get stuck ask for help from the treehouse community. 14 00:00:43,710 --> 00:00:44,710 All downloaded? 15 00:00:44,710 --> 00:00:47,330 Cool, I've got Android Studio open here. 16 00:00:47,330 --> 00:00:49,860 As usual, don't worry if your version of Android Studio 17 00:00:49,860 --> 00:00:52,170 is a little different than what you see here. 18 00:00:52,170 --> 00:00:54,720 Our developer tools are constantly evolving, but 19 00:00:54,720 --> 00:00:56,820 the main pieces will still be the same. 20 00:00:56,820 --> 00:01:00,920 More importantly, the code and concepts we are covering here are less volatile. 21 00:01:00,920 --> 00:01:03,680 So even if the tools are a little bit different, the code and 22 00:01:03,680 --> 00:01:05,430 ways to solve problems will still apply. 23 00:01:06,460 --> 00:01:09,784 So I want to open an existing Android Studio project and 24 00:01:09,784 --> 00:01:12,780 I cloned mine from GitHub in the development directory. 25 00:01:12,780 --> 00:01:14,720 So I'll select the project and click OK. 26 00:01:17,410 --> 00:01:18,630 Cool. 27 00:01:18,630 --> 00:01:23,030 You may see a warning up at the top about the Android SDK if you do just click OK. 28 00:01:23,030 --> 00:01:26,450 It happens sometimes because the SDK settings 29 00:01:26,450 --> 00:01:29,220 in the project of the original author may be different than your own. 30 00:01:30,610 --> 00:01:33,470 So the first thing we usually need to do when we import a project, 31 00:01:33,470 --> 00:01:35,260 is to fix it's Gradle settings. 32 00:01:35,260 --> 00:01:38,030 You're probably familiar with this already, but let's walk through it. 33 00:01:38,030 --> 00:01:41,490 Down here we see that the project currently expects a different version 34 00:01:41,490 --> 00:01:43,280 of the Android build tools. 35 00:01:43,280 --> 00:01:46,227 We could install this version here, but it's an older version and 36 00:01:46,227 --> 00:01:48,500 we usually want it to update to the latest version. 37 00:01:49,520 --> 00:01:53,210 So instead, let's open up the build.gradle file for our app. 38 00:01:53,210 --> 00:01:57,550 Click on Project and, well, there are multiple build.gradle files in here so 39 00:01:57,550 --> 00:01:59,230 how do we know which one to use? 40 00:01:59,230 --> 00:02:03,160 Well, click into App and this is the one for our app project so 41 00:02:03,160 --> 00:02:07,310 double click on build.gradle and here we see the value for our build tools version. 42 00:02:08,720 --> 00:02:13,090 Next question, how do we know what the latest value is that we should use here? 43 00:02:13,090 --> 00:02:15,530 We can check in the SDK manager. 44 00:02:15,530 --> 00:02:20,160 So click up here on the little down arrow for the SDK manager then click on SDK 45 00:02:20,160 --> 00:02:25,320 tools and up here at the top we have the Android SDK build tools and, this 46 00:02:25,320 --> 00:02:30,110 one is telling me that I have an update available on an early release channel. 47 00:02:30,110 --> 00:02:31,920 Well, I want to ignore that for now. 48 00:02:31,920 --> 00:02:33,390 To see my current version, and 49 00:02:33,390 --> 00:02:38,160 you may need to do this too, click on Show Package Details down here, and then scroll 50 00:02:38,160 --> 00:02:41,340 through the list to see what the highest number is that you have installed. 51 00:02:41,340 --> 00:02:43,430 So here you see the check box I have mine as 23.0.3. 52 00:02:43,430 --> 00:02:46,760 So click OK, go back to the file 53 00:02:46,760 --> 00:02:51,540 update to the latest version and then let's sync our changes. 54 00:02:53,480 --> 00:02:54,850 No, another error! 55 00:02:54,850 --> 00:02:57,580 This older version of the project is using an older version 56 00:02:57,580 --> 00:02:59,510 of the Android Gradle plugin. 57 00:02:59,510 --> 00:03:02,010 If you see this, feel free to click Update. 58 00:03:02,010 --> 00:03:05,920 That will fix the setting and the Gradle sync should now complete successfully. 59 00:03:05,920 --> 00:03:07,750 Whoops, we have one more error. 60 00:03:07,750 --> 00:03:11,710 Go ahead and click on Fix Gradle Wrapper and re-import the project and 61 00:03:11,710 --> 00:03:15,460 it'll sync again, and this time we're good to go. 62 00:03:15,460 --> 00:03:17,960 Let's run it to make sure that it's working. 63 00:03:17,960 --> 00:03:20,980 Click on the Run button, and I already have my emulator running so 64 00:03:20,980 --> 00:03:24,160 I'm going to click that and select Use same selection. 65 00:03:24,160 --> 00:03:28,619 Click Okay, and now I'll bring my emulator onto the screen as it loads. 66 00:03:33,945 --> 00:03:35,250 Okay, so here's our app. 67 00:03:35,250 --> 00:03:36,290 Looks like it's working. 68 00:03:36,290 --> 00:03:37,460 We're ready to go. 69 00:03:37,460 --> 00:03:41,080 Coming up next we'll revisit how to pass data from one activity to another.