[music] well g'day, g'day. it's tim buchalka, the aussie androiddev guy, here with another video. today we're talking aboutsetting up the path for android development on the linux machine.
Android jdk, now this involves setting the path forjava, but also for the android development tools. so we're gonna do that for linux now ifyou'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 youhow to do that on your machine, on your platform i should say. and that's because it's differenton a platform-by-platform basis. so let's get into now settingup the various android development command-line paths for linux. first thing's we're going to openthe 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 orit's a version under that, like it's 1.7 or something like that. refer to my video, which you canclick on the icon on screen now, to go to that video and make sure youinstall 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 rightnow to install that as well. so i'm going to assume that you've donethat, and you've now got java version 1.8 or higher and also got android studioinstalled 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 symboliclink to where java's installed. and think of a symbolic linkas a shortcut in windows 10, it's just basically a shortcut to wherejava'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 onthe computer where that's installed. so what we need is the path now sothat we can set our java, and it's called home variable. so the part we want isthis main part here. that's the part that wewant to take a copy of, but i'm just holding down my leftmouse button and copying that. gonna copy. so we don't want to departafter 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 andclick 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 andi'm gonna type java underscore home equal and i'm gonna paste inthe 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 soi'm just gonna remove that. that's number one thing. now we're going to talk export, java, and. it's going to tellthe script when it executes to set up the java to that pointer sothat's basically all we need to do.
so that's now setting up with java andvariable that we need to access. so once we've done that the nextstep is to go back to our terminal. i'm just gonna move thatover a little bit so they'll be more space whenwe 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 wholeheap of gobbledy gook but the part we're looking forhere is this part. we need to make sure that thatpath is correctly to find and it should have java in it.
now normally, you would have, for your myor may not have, java already in there. so if you see a folder in therewith oracle and so forth. it means that it'salready been configured. but if it's something that youcan see here clearly oracle and java is not in the path sowe're gonna have to add that. so what we're gonna do is goback to our other script. path equals andwe'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 intothe class path for is, which is good. we'll need to come back to that. the next we now need to do iswe need to go and find and set up the android stkenvironment variable. and then, we need to putthe various folders into the path. so, to do that we need tostart up android studio.
we're going to go and do that. open up android studio. and we need to go intoconfigure > project defaults. and then project structure. and that gives usthe android sdk locations. i'm gonna copy that. taking a copy of that. and i'm going to back in here andi'm going to type just above the path. android_home = andi'm going to paste in that value.
next we need to go back to path andput another colon. and type dollar android home slash tools colon then dollar android. /platform/tools. finally we need to endthat with another :$path. now it's important toget the case on these. case sensitivity is important here. so make sure you've typed itas you can see on the screen. now what that line does,
it sets up an adds java to the cont tvpath to make sure that can be accessed. but it also sets up the android sdk so we can access the android sdk varioustools from the command line as well. and then the dollar path on the end putadds to the end of the path that we've created whatever was previously onthere so that doesn't get chopped off. and one thing i forgot to do afterthe android home we need to type export. android underscore home. that save that and exports it. then lastly we need totell it export path.
so at this point we've now added java andthe android sdk to the path and we've also defined two environmentvariables pointing to the relevant paths. so what we're doing now iswe're going to save that. we're going to click on save andwe'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 justtap exit to close it down. and exit again causethere was two of them. and i had to get out ofthe 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 goingto execute that batch script. so, now if we type export, and scroll up. you can see that we nowhave all these folders. that i know in the path that weren'tthere 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 herethat obviously a duplication, so
i didn't see that when i was talkingbefore, perhaps i missed it. it means that the java pathwas already defined and i just duplicated it at the front, so icould go back to my bashrc script and just remove the first references that i addedto add java to the path if necessary. it wouldn't hurt to leave that there fornow. but the main thing isthe android tools are there. and also, just scrolling up, you know java_home is now defined which itshould be, pointing to the right place. and also scrolling up, we've also gotandroid_home pointing to the right place.
so obviously we need to tapjava 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 wecan 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 sortof problem with to access java, or more likely that you've typed inthe 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 buttonto the left of me if you want to be kept up to date withfuture videos as i release them. of course they're all about android. and if you're interestedabout android development, please also click on the link below me and check out my video course with 25plus hours of video footage, 11,000.
something that is of interest tobeginners or advanced developers alike. also check out some of my videosclick on here some of the videos to the left hand side. if you are interested in some ofthe things you see on there, and you can see yet more videos from me. yet last but by no means least, if you'vegot 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 meto cover in future videos. thanks for watching andi'll see you in another video.
adios, this is the aussieandroid dev guy signing off. cheers for now