Advertisement
English transcript
Right now we see a picture of a phone.
But this isn't actually on our phone.
This is pretty similar to when we were working with the XML visualizer.
Now we actually want to see our app on our phone.
To participate, you're going to need a USB cable like this.
Now this USB cable should fit your Android phone, which you will also need.
What do I mean by fit?
Well, I can pick up my phone and plug this cable into it.
Now if you don't have these things,
there's a slightly more complicated way you can get up and running.
Which I'm going to talk about in the next video.
But, if you have both of these items,
I really encourage you to use a real device, its a lot more fun that way.
All right.
First things, first.
Your phone is not set up to let random code from your computer run on your
phone by default.
So you're going to need to do a few steps to prep your phone.
Okay, so the first step is to become a developer.
This sounds a little funny, when would you know when you're a developer?
Well, what this actually means is changing around a couple of settings on
the phone, which will alow you to access developer options.
Once your phone's set up, you'll connect your phone to your computer
using the USB cable that I talked about before.
Now if you're using a Windows machine, the third step for
you, in Windows only, will be to install a driver.
And a driver is an extra little bit of software that will allow your
phone to communicate with your Windows machine.
With Macs, this just works by default, so you don't have to worry about it.
And finally, you'll install your app.
Alright, let's stop doing these steps.
On newer phones, running Android 4.2 and later,
you'll need to tell your phone you're a developer.
This is a pretty simple process that I'll show you right now.
The way to do this is to navigate to the Settings menu.
Once you're here, scroll down to the bottom and click on About phone.
On this menu, also scroll down to the bottom.
You should see something that says Build number.
Okay, so take the build number and click it 7 times.
Cool.
So now suddenly, you're a developer.
Wasn't that easy?
Once you're done, go ahead and hit the back button.
Now because of your new fancy title as a developer, you should notice that
the phone has provided you with a new option, the developer options.
Go ahead and click on that.
Okay, now in developer options there's a bunch of fancy sounding options, but
what I want you to do is scroll down until you see USB debugging.
And then go ahead and
click the little check box next to USB debugging to turn it on.
And say OK.
By checking this box,
it's allowing your computer to put applications onto your phone.
Awesome.
Now that you've enabled that,
you can take your handy dandy USB cable, plug one end into the phone, and
take the other end and plug it into your computer.
If you're on a Windows device,
there's one more step to set up your phone and computer.
Your Windows machine needs some software called the driver to communicate
with your phone.
I'll start by downloading the driver.
For most phones besides Google Nexus phones,
you can navigate to the Android OEM, which stands for
original equipment manufacturers, driver website.
A link is provided in the instructor notes.
I'm going to scroll down to the bottom.
Here I have a list of drivers for different phones, and
I will go ahead and download the appropriate one.
In my case, I have a nexus phone, so
I'm going to go up on the page, and click google USB driver.
This is again, for Nexus phones.
Okay, so for me, I'm going to go ahead and download the google USB driver,
Unzip it, I'm going to move this to my desktop.
So at this point, I've downloaded the driver, i've unzipped it and
I've put it on my desktop.
What you need to do next is double check that your phone is actually plugged in.
Okay let's look at our task bar.
I'm going to click on the start menu and go to computer.
In Windows Explorer I'm going to right-click on the word here that
says computer.
And then I'll go to manage.
In this left pane here, I'm going to select device manager, so
looking through this list, go ahead and
find the thing that says other devices and expand it.
Now you should see something here that refers to your phone.
For example, NexusS, or ADB,
which stands for android debug bridge, interface.
OK. Okay, so I'm going to right-click and
select update driver software.
This is going to launch a wizard that looks like this, and
I want to select the one that lets me browse my computer, because remember,
I just downloaded it to my desktop.
I'm going to do browse computer, and I'm going to go ahead and click browse.
And I'm going to go to my desktop and hit OK and hit next.
I might see some security messages like this.
Go ahead and say, install.
All right. Cool.
So, this autoplay just popped up with my Nexus 6, so that's a good sign
that now the computer's communicating well with my phone.
I'm going to go ahead and close this.
And the final window of the wizard,
says that Windows has successfully updated your driver software.
So that sounds awesome.
Go ahead and click close.
Basically at this point,
your phone is ready to accept the application from your computer.
Another way of saying that you can now install apps that
you've built on your computer, onto your phone.
Finally, were going to install our Hello World App from the computer
onto the phone.
To do this, you're going to go up to the top of Android Studio
to this green play button, and click it.
It will take about ten seconds or so for the next window to pop up so be patient.
At the bottom of the screen,
you should be able to see that there's some process being executed.
Now, if everything went as planned, your computer should detect your phone and
list it here.
Make sure you have the Choose a running device radio button clicked and
not the Launch emulator radio button selected.
If you can't see your phone, try unplugging it and re-plugging it in.
And then try restarting the phone.
If that also doesn't work and
you're on a Windows machine, you might have installed the wrong driver.
If none of those solutions seem to solve your problem, we've created
a troubleshooting document, which is linked in the instructor notes.
And you can always try asking your fellow students for help on chat or
in forums.
Okay, but hopefully things are working.
You can select your phone and click the OK button.
After about five seconds you should see your phone looks like this.
You've now successfully run your first android application on a phone.
Awesome work.
As we start thinking about our birthday card application,
I want you to think about a friend who's having a birthday that's coming up.
Now, my challenge to you is to change the app that we currently have
to say happy birthday and then that person's name,
and then to run that app on your phone.
Remember, you'll need to change the main activity .xml code file
the same way we practiced changing code in the Internet browser.
Right now the text says hello world, but you should be able to find the correct
attribute to change it to say, Happy Birthday and then your friend's name.
After you've done that, press the green run button and
install the app on your phone.
Good luck.
But this isn't actually on our phone.
This is pretty similar to when we were working with the XML visualizer.
Now we actually want to see our app on our phone.
To participate, you're going to need a USB cable like this.
Now this USB cable should fit your Android phone, which you will also need.
What do I mean by fit?
Well, I can pick up my phone and plug this cable into it.
Now if you don't have these things,
there's a slightly more complicated way you can get up and running.
Which I'm going to talk about in the next video.
But, if you have both of these items,
I really encourage you to use a real device, its a lot more fun that way.
All right.
First things, first.
Your phone is not set up to let random code from your computer run on your
phone by default.
So you're going to need to do a few steps to prep your phone.
Okay, so the first step is to become a developer.
This sounds a little funny, when would you know when you're a developer?
Well, what this actually means is changing around a couple of settings on
the phone, which will alow you to access developer options.
Once your phone's set up, you'll connect your phone to your computer
using the USB cable that I talked about before.
Now if you're using a Windows machine, the third step for
you, in Windows only, will be to install a driver.
And a driver is an extra little bit of software that will allow your
phone to communicate with your Windows machine.
With Macs, this just works by default, so you don't have to worry about it.
And finally, you'll install your app.
Alright, let's stop doing these steps.
On newer phones, running Android 4.2 and later,
you'll need to tell your phone you're a developer.
This is a pretty simple process that I'll show you right now.
The way to do this is to navigate to the Settings menu.
Once you're here, scroll down to the bottom and click on About phone.
On this menu, also scroll down to the bottom.
You should see something that says Build number.
Okay, so take the build number and click it 7 times.
Cool.
So now suddenly, you're a developer.
Wasn't that easy?
Once you're done, go ahead and hit the back button.
Now because of your new fancy title as a developer, you should notice that
the phone has provided you with a new option, the developer options.
Go ahead and click on that.
Okay, now in developer options there's a bunch of fancy sounding options, but
what I want you to do is scroll down until you see USB debugging.
And then go ahead and
click the little check box next to USB debugging to turn it on.
And say OK.
By checking this box,
it's allowing your computer to put applications onto your phone.
Awesome.
Now that you've enabled that,
you can take your handy dandy USB cable, plug one end into the phone, and
take the other end and plug it into your computer.
If you're on a Windows device,
there's one more step to set up your phone and computer.
Your Windows machine needs some software called the driver to communicate
with your phone.
I'll start by downloading the driver.
For most phones besides Google Nexus phones,
you can navigate to the Android OEM, which stands for
original equipment manufacturers, driver website.
A link is provided in the instructor notes.
I'm going to scroll down to the bottom.
Here I have a list of drivers for different phones, and
I will go ahead and download the appropriate one.
In my case, I have a nexus phone, so
I'm going to go up on the page, and click google USB driver.
This is again, for Nexus phones.
Okay, so for me, I'm going to go ahead and download the google USB driver,
Unzip it, I'm going to move this to my desktop.
So at this point, I've downloaded the driver, i've unzipped it and
I've put it on my desktop.
What you need to do next is double check that your phone is actually plugged in.
Okay let's look at our task bar.
I'm going to click on the start menu and go to computer.
In Windows Explorer I'm going to right-click on the word here that
says computer.
And then I'll go to manage.
In this left pane here, I'm going to select device manager, so
looking through this list, go ahead and
find the thing that says other devices and expand it.
Now you should see something here that refers to your phone.
For example, NexusS, or ADB,
which stands for android debug bridge, interface.
OK. Okay, so I'm going to right-click and
select update driver software.
This is going to launch a wizard that looks like this, and
I want to select the one that lets me browse my computer, because remember,
I just downloaded it to my desktop.
I'm going to do browse computer, and I'm going to go ahead and click browse.
And I'm going to go to my desktop and hit OK and hit next.
I might see some security messages like this.
Go ahead and say, install.
All right. Cool.
So, this autoplay just popped up with my Nexus 6, so that's a good sign
that now the computer's communicating well with my phone.
I'm going to go ahead and close this.
And the final window of the wizard,
says that Windows has successfully updated your driver software.
So that sounds awesome.
Go ahead and click close.
Basically at this point,
your phone is ready to accept the application from your computer.
Another way of saying that you can now install apps that
you've built on your computer, onto your phone.
Finally, were going to install our Hello World App from the computer
onto the phone.
To do this, you're going to go up to the top of Android Studio
to this green play button, and click it.
It will take about ten seconds or so for the next window to pop up so be patient.
At the bottom of the screen,
you should be able to see that there's some process being executed.
Now, if everything went as planned, your computer should detect your phone and
list it here.
Make sure you have the Choose a running device radio button clicked and
not the Launch emulator radio button selected.
If you can't see your phone, try unplugging it and re-plugging it in.
And then try restarting the phone.
If that also doesn't work and
you're on a Windows machine, you might have installed the wrong driver.
If none of those solutions seem to solve your problem, we've created
a troubleshooting document, which is linked in the instructor notes.
And you can always try asking your fellow students for help on chat or
in forums.
Okay, but hopefully things are working.
You can select your phone and click the OK button.
After about five seconds you should see your phone looks like this.
You've now successfully run your first android application on a phone.
Awesome work.
As we start thinking about our birthday card application,
I want you to think about a friend who's having a birthday that's coming up.
Now, my challenge to you is to change the app that we currently have
to say happy birthday and then that person's name,
and then to run that app on your phone.
Remember, you'll need to change the main activity .xml code file
the same way we practiced changing code in the Internet browser.
Right now the text says hello world, but you should be able to find the correct
attribute to change it to say, Happy Birthday and then your friend's name.
After you've done that, press the green run button and
install the app on your phone.
Good luck.