Create Your First Android App (Android Development Fundamentals, Unit 1: Lesson 1.1)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
♪ (upbeat electronic music) ♪ Okay, now you have seen what exactly is Android. So, now it's time to create your very first app in Android. In this particular slide, we are going to cover about Android Studio, create our very first "Hello World" app, and we're going to understand the basic app development workflow in Android Studio. And then, run our app in a virtual device, and even in a physical device. The prerequisites for Android application development will be Java programming language, and you need to have a good idea about object-oriented programming, and XML-- how exactly you put properties and attributes in XMLs. And you need to have a good idea of IDE, a prior IDE, it doesn't really matter, an IDE which you have used in the past. And we will see how exactly we work around with our Android Studio. So your Android Studio will look like this, and it will contain many tools, like de-buggers, logcat, monitors, emulators. So we're going to look at each one of them in coming slides. First of all, we need to learn how exactly we can install Android Studio in our machines. So, first we need to download JDK. So, we'll go to our browser, and type "download JDK." Download the latest one, JDK 8. This will take you to the Oracle website. Accept the license agreement, and download it for whatever the machine you are working with. For me, it's Mac, so I will download that. Once your JDK is downloaded, install your JDK. Install your JDK. And, <i>Continue, Install</i> (typing) The steps in Windows will be pretty much the same. (installer chimes) Once the JDK is installed, now, next you can go through downloading your Android Studio. Just type "download Android Studio". And, just click on the link. It will take you to the developer website, and from here, you can download Android Studio. It will identify automatically in which machine you are working, and it will give you-- if you are working with Mac, it will give you Android Studio, Mac version. If you are working with Windows, it will give you Android Studio with Windows version. Or, the same goes with Linux. So, download the Android Studio, accept the license and download. Once your Android Studio is downloaded, you can start installing your Android Studio. In Mac, you can just drag and drop in Applications folder. In Windows, you will just double-click your Android Studio and it will get you to Windows, and from there you just have to follow the instructions, and that's next-- and install. And then, you can go here, you'll see Android Studio here. Press on Android Studio-- click on Android Studio and <i>Open</i>. Now, for the very first time, It will ask you for installation of SDK. By default, it always installs the latest SDK. Where exactly you want to install your SDK, so this will be the path. You just click on <i>Next</i>, and <i>Finish</i>. So, once the latest component has been downloaded, press <i>Finish</i>, and you will get to this screen. Now, from here on, before right away getting into creating a new project, you'll click on <i>Configure</i>, and click on <i>SDK Manager</i>. What exactly we are doing here is we are installing further SDK's, which we will be needing while we are developing our Android applications. Either you can install SDK's from here, just click on Android 7.1, or whichever version you want. Just click on that and press <i>OK</i>. Or, you can always go on Launch Standalone SDK. Launch Standalone SDK will give you more freedom to install your Android versions. For example, in your Android 7.1.1, API 25, you don't really need a system image of Android TV, because we are not going to design-- or, this development is not going to be for your Android TV. We might need Google API Intel x86 Adam 64 System Image. If I am using 64, so I don't need x86. So, you see, you can select whatever you want to download, and whatever you don't want to download. So, this is for your latest. If you want to work with other versions also, you just have to go inside those versions. You just have to click those versions, and select whatever you want to download inside those versions. Like in Android 6.0, you definitely want SDK Platform. You don't want TV. You don't want Wear system images installed. You don't want Android Wear system images also. Then, you don't want ARM system images also. Now, ARM is again a system image, or it gives you an emulator which can run your application, but ARM machines are slower. So, that's why we need Intel machines, which are pretty faster as compared to ARM. Now, in that context also, I could have chosen Intel, normal machine. But, I will be choosing Google API's Intel machine here, maybe 64-bit, or 32-bit, according to your system configuration. Why Google API's Intel machine? Because it gives you all the features which you have in your normal Intel machine, plus it always provides you with more freedom to use your Google API's also. So, if you are using a Google API Intel machine, then you might have to download Google API's also. And then, you definitely need the source code for your Android SDK. Now, this is for one of the stable versions in the higher one, but if you want a minimum version also, like we'll be working with one of the minimum versions, with API 15, you are free to select whichever version you want as your minimum version. You can go ahead and install stuff from that particular version also. Like we need SDK platform, we are not going to work with ARM. And here, also, we'll be working with Google API Intel x86 machine, and Google APIs, and source code for SDK. Like I said before, you can download ARM and other machines, but it's of no use, because we won't be using them. We want our application to be running in a pretty faster manner, so for that purpose we need Intel machines with the Google API's in them. After that, just go to the bottom, just come to the Extras section. In that Extras section, you will require Google Play services if you want to use any Google API's, like Maps, or the billing system of Google API. And then, for Windows, you might require Intel x86 Emulator Accelerator to run your Intel machine in your Windows phone. And then, you can just click on <i>Install Packages</i>, accept the license. Accept the license for other options also, and click on <i>Install</i>. And this will start installing your other Android SDK. So now, you have seen how to install the Android Studio. So let's just learn how to create your very first application, "Hello, World" application. This will be the very first screen you will be seeing, and you can create a new project by clicking on the very first option, <i>Start A New Android Project</i>. Or, you can always create a new project from inside the Android Studio. You will get transferred to this screen, and this is where you put the name of your application, what you want to name your application, and the project location, where exactly you want your application to be saved. After that, you will get transferred to the different templates. >From all those different templates, we will select <i>Empty Template</i>, as we want to start from the very scratch. Next, we will give the name to our activity. Like I said before, activity is a screen, and we want to create our very first screen for the application. And activity is not just a Java code, it contains the UI part also. So it will have a Java file, plus a XML file also, which will contain its UI part. So we will name Java file as <i>MainActivity</i>, and XML file as<i> activity_main</i>. This is how your Android Studio will appear at the very starting. As you can see, on your left is your Project Files. >From this pane, you can navigate through your project, or you can click on any one of these files, and you can open those files. In the middle, you have Layout Editor or Code Area, where you can either create your layout, UIs, drag and drop, or, you will be writing your code in this middle area. At the bottom is known as Console Area, where you will see the status reports, or logcats, log messages of your application, or the application you are creating. When we talk about project folders, there will be four folders. First will be manifest folder, which will contain a manifest file, which will give you the information about the application itself. Next will be java, which will contain all your Java code. Next will be res, which will contain all your resources. It can be a layout, it can be a string, it can be images, it can be audio files. So all those resources will be kept inside your res folder. Last will be <i>build.gradle</i> files. So, <i>build.gradle</i> files will give you the information about building your project and app and module. We will see about this in further slides. So, let me talk about Gradle. Gradle is a building tool used by your Android Studio. And there are basically three types of Gradle files: first, project-level Gradle files, module-level Gradle files, and settings Gradle files. What, exactly, a project-level Gradle file contains? A project-level Gradle file will contain the information about Gradle itself. What is the version of Gradle you are using, and what kind of repositories you are using inside your application. So, there will be one project Gradle file per application. Next will be module Gradle file. Now, there can be one module Gradle file, or more than one module Gradle file. It depends upon the number of modules you are making for your application. Now, if you are creating an app, let's say a weather application for mobile also, for Wear also, and for TV also, now there will be three module Gradle files, giving the information about each module. Each module Gradle file gives you the information about each module, like in which version you are creating that particular module, what is the minimum version, what is the maximum version, what is the application IDE, or what are all the dependencies, so that will give you the information about the module-level Gradle file. Last is known as settings Gradle file. Settings Gradle file gives you the information about which module you want to include for your compilation. So, if you just want to compile your mobile module, then you will just include the mobile module inside the Gradle file. If you want to compile mobile plus TV, then you will include mobile module plus TV module. For more information, you can follow the link about the Gradle. Now, once you have followed all these steps, there will be a default app for you, "Hello World". So, how do you run that application? There is a Run button at the top, you click on that Run button, and it will ask you for a virtual device. So, you can always create a virtual device. There will be a button,<i> Create New Virtual Device</i>, or you can go to your Android AVD Manager, that is, Android Virtual Device Manager. >From there, you can choose the hardware-- which hardware you want to use, and for which resolution you want to create an emulator, either Nexus 4 or Nexus 5. And then, click on one of the hardware resolutions. Click on <i>Next</i>, and then you can choose which version you want to install in that particular hardware, Android 7.0 and Android 6.0. Now, please be apprised that whichever SDK you downloaded at the time of installation, only those system images will come here. So, whichever system images you downloaded at the time of SDK installation, only those system images will come inside this, and you can use one of those system images here. And then, you can give the name to your Android Virtual Device, and then click <i>Finish</i>. And it will give you your Android emulator, and this is how your Android emulator looks like. You can always make your real device also as a testing device. For that to happen, you have to make your real device a developer device, or you have to turn on your device in developer mode. How do you do that? Go to <i>Settings</i>, click on <i>About Phone</i>, and inside there will be build number. Now, tap into the build number seven times. Yeah, seven times. And then you will see that the developer option, which was hidden before into the settings, is available now. Now, go inside the developer option, and turn on your USB Debugging mode. And there you go-- your device is now a developer device. Now, this is the first part. If you are using Mac, this is all you have to do. Now you have to connect your USB cable to your machine, and you will be able to run your applications. But if you are not using Mac, if you are using Windows or Linux machines, then you might have to download USB drivers for that particular device also, and install that in your machine. And after that, you connect to the USB cables, and you will be able to run your application in your real device also. As your app runs, and you want to get the feedback, you want to see what exactly is going on inside your app, so for that purpose we have a logcat tool, which is inside your Android Monitor. Whenever you will be running your app, you will see this-- all the logs inside your logcat popping up. So this will keep track of whatever is going on inside your emulator, or your Android device. So, this is how you put a log. <i>Log.d</i> -- for debug mode -- give a tag and give the message. You will learn about logging in detail in further slides. So, this is how your logcat pane looks like. So you can see, you have to enter a log statement inside your Java code, and then at the bottom, you will see inside the Android Monitor there is a logcat pane, and that's where you can see whatever the log statement you have put inside your Java code. To learn more, you can follow these links about creating and managing Android Virtual Studio and different platform versions. So next you can follow the concept in <i>Kit Book</i> exercise 1.1, and then we are going to go through with the practicals of creating your very first Hello World app, and run it into the emulator. ♪ (upbeat electronic music) ♪
Info
Channel: Google Developers India
Views: 94,376
Rating: undefined out of 5
Keywords: Android, Android Studio, app, apps, app development, workflow, virtual, virtual device, device, product: android, fullname: other, Location: SYD, Team: Scalable Advocacy, Type: DevByte, GDS: Yes;
Id: 6uWPMcJLrC4
Channel Id: undefined
Length: 17min 21sec (1041 seconds)
Published: Sat Feb 04 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.