1.2 Project Setup
In this lesson, you’ll learn how to enable Java 8 in an Android Studio project.
1.Introduction2 lessons, 03:26
2.Java 8 Features6 lessons, 32:47
3.Conclusion1 lesson, 00:39
1.2 Project Setup
Welcome again. In this lesson, we are going to create a new Android Studio project and configure it to use Java 8 instead of Java 7 as the programming language. So go ahead and fire up the latest version of Android Studio. If you don't have the latest version, you can download it from this website. You'll find a link to it below. Using a version that's greater than 3.0 is very important, because anything older will have poorer support for Java 8. So I'm using Android Studio 3.0.1. Here, in the quick start wizard, as usual press the start a new Android Studio Project button. Give your application a name and make sure that the include Kotlin support option is unchecked. Obviously we won't be needing any Kotlin in this course. Here choosing the right minimum API is extremely important. The number of Java 8 language features that will be available in this project depends on the API level. API level 24 is usually good enough, because you'll get a majority of the features, so make sure you choose it. In the next screen, choose Empty Activity. You can optionally change the name of the activity here. And finally, press Finish to start the project generation. All right, the project has been successfully created. Now to configure it to use Java 8 instead of Java 7, go to File > Project Structure. Select the app module and then, set the Source Compatibility of the module to Java 1.8. Similarly, set the Target Compatibility to 1.8. And press OK. You'll now see these lines added to your app modules build.gradle file. This means that the product is ready to use Java 8. That's all you need to do to configure the project. In the next lesson, we'll start writing some Java 8 code. I'll see you there, thanks for watching.