Now in the previous lesson, we have installed android studio and we installed the flutter and dart plugins. So if you missed out on that be sure to head back to the last lesson to see how. Now we have this link on the Android Studio welcome screen which allows us to start a new flutter project.
So once you're ready go ahead and click on this to build your very first flutter app. We're gonna choose a flutter application and click Next and you're gonna give your project a name. Let's just call it testing with the underscore App and then make sure that the flutter SDK path is listed here as the one that matches what you have on your system. Android studio is usually clever enough to pick up what the path is that you set in your path variable two lessons ago. and if you haven't then be sure to take a look at that video to see how we set this up alternatively. You can also specify a path by clicking on these three dots and you can choose the location where your flutter SDK is located. But by way, just be sure that it can get access to the flutter package. Now the project location is where this current project is going to be saved and it doesn't matter where you save it. Because we're gonna delete it shortly anyways this is just for testing to see if we can get it all up and running and make sure that we've done all the setup correctly. So once you're ready click on next and you can leave the company domain as example.com and go ahead and click finish to build your first flutter app. Now once that's done you should see a file called the main dot open up in Android studio and this already has some sample code that the flutter team has written to be able to build a really simple counter app. Now to run it on Android we're going to need an emulator and the way that we get an emulator is by going to the AVD manager so it's the one right over here. it's got the little Android icon and a little phone icon combined and if you click on it. it should take you to set up a new virtual device now in terms of performance. I recommend choosing a Nexus device so for example the Nexus 6 or the 6p once you've chosen. it goes ahead and clicks Next and now you get to choose an operating system. now if you've already installed an operating system then you should be able to simply select it and click Next but otherwise, simply click on the download button for the operating system of your choice and just let it download and install now this might take about five to ten minutes. But just be patient and it should be done soon. now once that's complete go ahead and click finish. You can now choose that new operating system that you downloaded and installed so now we can go ahead and click Next and here you can give you a video name or choose whether if you want to have the device frame but most importantly you're going to enable hardware acceleration by going under the emulated performance drop-down list and switching your graphics from automatic to hardware-accelerated and this is going to make your emulator run so much faster. so this is why we chose a Nexus device rather than a pixel device so once you're done over here go ahead and click finish and you're now all done with setting up your virtual device.
if you want to give it a go and see what it looks like then go ahead and click on the play button right here and your chosen emulator should now launch it. here's our brand-new emulated device so now I'm going to close down this window but remember you can always get back to it just by clicking on that icon over there which is your AVD manager now at this point I want to test out this sample code that the flutter team has created and I'm gonna test it onto my virtual device so over here is where you choose the device that you want to test it onto a little bit later on after we create our first app we're going to launch our app onto a physical device as well and I'll walk you through the steps that are required a little bit later on now if you have more than one emulated device. You'll see they show up here so select the one that you want to build your app for and then go ahead and click on the play button.
Now in order to see the progress of the running of your app, you'll see it inside your console down here and you'll see the various stages that it's going through and the part where initializes Gradle usually takes the longest, so give it a few minutes and it should launch automatically onto the phone. Now once it's done the loading bar down here will disappear and you should see the flutter demo app show up on the screen. now this is a really simple counter app as soon as you push the button then the counter goes up and that's pretty much all it does but if you've gotten this far then congratulations you have completed all of the steps in Windows setup and you are now ready to start building flutter apps for Android development now in the coming lessons I'll be running most of the apps in the iOS simulator but it's effectively the same if you're using the Android emulator now if you're ready you can go ahead and delete this testing app and head over to the start of the course where we'll build our very first app.
0 Comments