Creating the Project5:37 with Ben Jakuben
In this video we will review our tools and create the shell of our project in Android Studio.
You can download and install Android Studio from the Android developer site. You can use any version you like and you may just need to work through slight differences in the tools. If you want to use the exact version we use in this course, make sure to download this version from the list: "Android Studio v2.3.0 (March 2017)."
Installing Android Studio
Need help setting up your Android development environment? Check out these setup instructions:
Importing Project Files
Project files for each video are available in the Downloads tab. Once downloaded, select File > Open from the Android Studio menu and then navigate to the InteractiveStory folder that you unzip from the project files. When you have that folder selected, click "Choose" and the project will be opened in a new Android Studio window.
- End of Stage 1 video 2 (starter files)
Let's talk for a minute about the tools we're going to use for this project. 0:00 In an effort to provide you with a consistent learning experience, we're 0:03 providing the exact version of Android Studio used to record these videos, 0:06 in the download links below. 0:10 It includes the appropriate SDK and emulator image I'm using. 0:12 If you download and use these tools, 0:16 then everything should match up as long as you don't update anything. 0:17 Now, don't worry, if you do update or 0:20 if your version of Android Studio is a little different than what you see here. 0:22 Our developer tools are constantly evolving, but 0:26 the main pieces will still be the same. 0:28 And more importantly, the code and 0:30 the concepts we are covering here are less volatile. 0:32 So even if the tools are a little bit different, the code and 0:34 the ways to solve problems will still apply. 0:37 If you really get stuck because of Android Studio, you can either get help from our 0:40 Treehouse community or reinstall these versions of the tools. 0:43 You can even have more than one version installed at a time. 0:46 As usual if any minor changes or 0:50 bugs pop up in these videos, then we will add a visual call out like this. 0:51 And then I'll add notes for screenshots in the teacher's notes. 0:56 So if you spot a difference, check the notes first and then let us know. 0:59 Remember it's really important to follow along and not just watch these videos, 1:04 because you will learn so much more. 1:07 If you get stuck with your own code, you can always download the project 1:10 files on each video page for my code from the video. 1:13 Which you can then use for comparison or as a starting point for your own work. 1:16 Okay, make sure you have Android studio set up how you want it and 1:21 then let's start the project. 1:23 Okay, so once Android Studio loads up, 1:25 let's click on Start a New Project here at the top. 1:28 The first thing we need here is a name for our application. 1:31 Let's call this Interactive Story. 1:34 Now my company domain was already filled in with teamtreehouse.com, but 1:38 you can use whatever you'd like here. 1:42 Whether it's your own organization, or perhaps just your own name. 1:44 For example, for 1:47 my personal projects I will often just use jakuben.com as my personal domain. 1:48 One thing I should note is that you do want to use just lowercase letters and 1:53 periods like we have here. 1:56 You don't want to use any other special characters or 1:58 uppercase letters as they may cause problems. 2:00 So moving on, we see the package name is generated down here with the domain name 2:03 and then the project name here at the end. 2:07 I'm going to change my project location, 2:09 though you certainly don't have to do this. 2:11 I'm gonna change this to Development and click Next. 2:14 Now on this screen we want to select the form factors that our app will run on, 2:17 as well as the Minimum STK that we wanna target. 2:21 This app is just going to be for phones and tablets, so 2:24 we don't need to check anything else. 2:27 And we can accept the default minimum SDK, which, at the time of this recording, 2:28 is API 16. 2:33 Don't worry if your minimum version is different. 2:33 Backwards compatibility is easier than ever thanks to some changes in how Android 2:36 handles API versioning. 2:40 Notice that this tell us that by going with this default setting, 2:41 our app will run on approximately 95.2% of devices active on the Google Play Store. 2:44 And that's pretty much our market, 2:50 since we're developing apps we want to be available on Google Play. 2:52 And this lets us use some of the newer and more stable features of Android, 2:54 without having to worry about backwards compatibility from much older devices. 2:58 If we click on Help me choose, 3:02 we can see a further breakdown of what people are using. 3:04 I'm gonna click OK and click Next. 3:06 Now in this screen, we want to select one of these project templates. 3:09 We can see a bunch of different types of activities here for 3:12 different types of screens. 3:15 You might think this basic activity would be appropriate but we don't want 3:16 to include this floating action button, or FAB, that we see down here. 3:19 So, with empty activity selected, let's click Next. 3:23 The default name here, Main Activity, is fine because the default activity 3:27 will be the main activity that runs when our app launches. 3:30 Let's leave the layout name as it's generated and then make sure that this 3:33 Backwards Compatibility box is checked for app compat here. 3:37 We'll talk a little bit more about this later, okay? 3:40 Let's click Finish. 3:42 Okay, once we get to this screen, our project is ready. 3:47 We can see down here there's a message that our gradle build finished. 3:50 Now before we continue, I wanna show you one thing. 3:53 Expand this gradle scripts section here on the left, and then double 3:56 click on the second build.gradle file, the one that has module:app shown after it. 4:00 We haven't talked much yet about Gradle. 4:04 But that's the build system that sets a bunch of configuration parameters for 4:07 our projects. 4:11 At some point, you will likely need to make changes to this file 4:12 as new versions of Android and Tools are released. 4:15 But for now, I just want to give you a quick tour of what we see here. 4:17 Notice that there are a few different settings about SDK versions. 4:20 Up here, we have the compile SDK version and it's set to 25, 4:23 which is the latest version I currently have installed on my computer. 4:27 This is the version of the SDK that you have installed that's used to 4:31 compile your app. 4:34 But it can still run on older versions of the SDK, 4:35 down to the minimum which we see here. 4:38 And here we see the number 16 which is what we selected in our project wizard. 4:41 Then we have the target SDK version which is often the same 4:45 as the compile SDK version. 4:48 This represents the SDK which we've tested our app against, and 4:50 if it's set to something different, 4:53 it may enable compatibility behaviors automatically for us. 4:55 So anyhow, if you need to change any of these after you first create the project 4:58 like when a new version of the SDK is available, you can come in here and 5:01 change the values directly. 5:05 Now if you're wondering how to get all these different versions of the SDK, 5:07 you can use the SDK Manager. 5:10 Which is this little icon here, with the arrow pointing into the Android's head. 5:12 So if we click on that, 5:17 it will show what is installed in our version of Android Studio. 5:18 This is where we can come and download newer versions as they become available, 5:22 although Android Studio will also prompt us. 5:26 Okay, I'm going to close this with Okay, and close this gradle file, 5:28 and we're back in our app, and we're ready to continue. 5:32 Let's take a short break, and then we'll start coding. 5:35
You need to sign up for Treehouse in order to download course files.Sign up