[MUSIC]
Well g'day, g'day.
It's Tim Buchalka, the Aussie Android dev guy, here with another video.
Today we're talking about setting up the path for
Android development on the Linux machine.
Now this involves setting the path for Java, but also for
the Android Development Tools.
So we're gonna do that for Linux Now if you're wanting to do this on a Mac or
on a Windows machine, refer to the videos to my left.
And I've got a video to show you how to do that on your machine,
on your platform I should say.
And that's because it's different on a platform-by-platform basis.
So let's get into now setting up the various Android
development command-line paths for Linux.
First thing's we're going to open the Applications and go in to Terminal.
Let's move this over a little bit.
We're gonna type java -version.
Now if that comes back with version, like you can see on
the screen there java version 1.8.0_25, that means we have installed Java.
If you get some sort of weird error Or it's a version under that,
like it's 1.7 or something like that.
Refer to my video, which you can click on the icon on screen now,
to go to that video and make sure you install the most recent version of Java.
And while you're there, make sure you also install Android Studio.
There's a link on the screen right now to install that as well.
So I'm going to assume that you've done that, and you've now got Java version 1.8
or higher and also got Android Studio installed on this computer.
So moving forward we'll type pseudo.
Pseudo space SUV.
Type in our regular password.
Then we're going to type which space java.
And that gives us a symbolic link to where Java's installed.
And think of a symbolic link as a shortcut in Windows 10,
it's just basically a shortcut to where Java's installed on the computer.
What we need to know is the actual folder, so we're gonna type readlink
space -f /usr/bin/java And
that will give us the location on the computer where that's installed.
So what we need is the path now so that we can set our Java,
and it's called home variable.
So the part we want is this main part here.
That's the part that we want to take a copy of, but
I'm just holding down my left mouse button and copying that.
Gonna copy.
So we don't want to depart after the /jre/bin/java.
We don't want that part.
We only wanna put the path in.
So next I'm gonna open a new window.
I'm gonna go to File and click on Open Tab.
I've got another tab open.
I'm gonna type gedit.
And firstly I'm gonna do a pwd.
You see that we're in our home folder.
So I'm gonna type gedit.bashrc.
That brings up this little bash script.
And I'll scroll to the bottom of that and I'm gonna type Java underscore home
equal and I'm gonna paste in the value that I copied a minute ago.
Down here, I'm gonna paste that in.
So that's our path to Java.
We don't need the last slash so I'm just gonna remove that.
That's number one thing.
Now we're going to talk export, Java, and.
It's going to tell the script when it executes
to set up the Java to that pointer so that's basically all we need to do.
So that's now setting up with Java and variable that we need to access.
So once we've done that the next step is to go back to our terminal.
I'm just gonna move that over a little bit so
they'll be more space when we click on the tab again,
next one is just type in the word export, in lower case, press enter.
And look, it's just a whole heap of gobbledy gook but
the part we're looking for here is this part.
We need to make sure that that path is correctly to find and
it should have Java in it.
Now normally, you would have, for your my or may not have, java already in there.
So if you see a folder in there with Oracle and so forth.
It means that it's already been configured.
But if it's something that you can see here clearly Oracle and
Java is not in the path so we're gonna have to add that.
So what we're gonna do is go back to our other script.
Path equals and we're gonna type dollar, java_home.
So make a space here just to clear it.
This is easy to read.
So it's java path slash bin.
Then we're gonna type
:$java_home/db/bin:$java_home/jre/bin
That's putting the required folders into the class path for is, which is good.
We'll need to come back to that.
The next we now need to do is we need to go and find and
set up the android STK environment variable.
And then, we need to put the various folders into the path.
So, to do that we need to start up Android Studio.
We're going to go and do that.
Open up Android Studio.
And we need to go into Configure > Project Defaults.
And then Project Structure.
And that gives us the Android SDK locations.
I'm gonna copy that.
Taking a copy of that.
And I'm going to back in here and I'm going to type just above the path.
Android_home = and I'm going to paste in that value.
Next we need to go back to path and put another colon.
And type dollar android home
slash tools colon then dollar android.
/platform/tools.
Finally we need to end that with another :$path.
Now it's important to get the case on these.
Case sensitivity is important here.
So make sure you've typed it as you can see on the screen.
Now what that line does,
it sets up an adds Java to the cont TV path to make sure that can be accessed.
But it also sets up the Android SDK so
we can access the Android SDK various tools from the command line as well.
And then the dollar path on the end put adds to the end of the path that we've
created whatever was previously on there so that doesn't get chopped off.
And one thing I forgot to do after the Android home we need to type export.
Android underscore home.
That save that and exports it.
Then lastly we need to tell it export path.
So at this point we've now added Java and the Android SDK to the path and
we've also defined two environment variables pointing to the relevant paths.
So what we're doing now is we're going to save that.
We're going to click on save and we're going close it down.
Cancel. We're going to close down Android Studio.
We need to close down the folder, we need to close down terminal.
See what I'll do I'll just tap exit to close it down.
And exit again cause there was two of them.
And I had to get out of the SU that I was in.
And, let's close it down.
I'm just going to open it again now.
And, by opening it again it's going to execute that batch script.
So, now if we type export, and scroll up.
You can see that we now have all these folders.
That I know in the path that weren't there before at the top there.
You can see the ones I'm talking about.
These are the ones that we've added, we added all of those.
If you do see this, you can see here that obviously a duplication, so
I didn't see that when I was talking before, perhaps I missed it.
It means that the Java path was already defined and
I just duplicated it at the front, so I could go back to my BashRC script and just
remove the first references That I added to add Java to the path if necessary.
It wouldn't hurt to leave that there for now.
But the main thing is the Android tools are there.
And also, just scrolling up,
you know Java_home is now defined which it should be, pointing to the right place.
And also scrolling up, we've also got Android_home pointing to the right place.
So obviously we need to tap Java space [INAUDIBLE] version,
which should still work anyway, but we'll type that.
So that's good. That's still working.
But the other thing we can type is android.
And if we get that coming up, the SDK manager comes up.
We know that we got the paths all correct.
If you get an error there,
it means that there was some sort of problem with to access Java, or
more likely that you've typed in the Android SDK folders incorrectly.
And that's a wrap.
We're done and dusted.
I hope you enjoyed that video.
Please do click on subscribe button to the left of me if you want
to be kept up to date with future videos as I release them.
Of course they're all about Android.
And if you're interested about Android development,
please also click on the link below me and
check out my video course with 25 plus hours of video footage, 11,000.
Something that is of interest to beginners or advanced developers alike.
Also check out some of my videos click on here some of the videos to
the left hand side.
If you are interested in some of the things you see on there, and
you can see yet more videos from me.
Yet last but by no means least, if you've got time please do leave a comment and
let me know what you thought of the video, what you got out of it, and
of course what you want me to cover in future videos.
Thanks for watching and I'll see you in another video.
Adios, this is the Aussie android dev guy signing off.
Cheers for now