Appium Beginner Tutorial 6 | How To Connect Real Android Device On Mac OS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome I'm rocof and today we are going to learn how to connect a real Android mobile device on a Mac operating system and this is going to be very easy and very interesting and do not worry if you do not have any prior knowledge on this topic I am going to go very basic step-by-step and before I go to the steps I will also tell you that this process of connecting our device on Mac OS this is a completely separate process and it will not impact whether you have IBM on your system or not so in case you are doing automation with IBM you can install IBM before this process or after this process it is completely fine and this is a completely separate process so let's get started and before I begin there are some prerequisites so we need to have Java on our system so Java should be installed on the system Java home environment variables should be set and our command to check that is Java space hyphen version so you can go to your terminal I am pressing command space bar on my keyboard to bring out this spotlight search and I will say terminal and hit enter to go to the terminal and here I will say Java space hyphen version and hit enter and you can see the our Java version is Java 8 I can also check the compiler version by saying Java C space hyphen version and this will show me the compiler version of Java now just in case you do not have Java you can go to my channel on YouTube which is automation step by step so you can go to youtube forward slash automation step by step and if you go to the playlists here you will find a playlist for Java so here if I go down you will see a playlist for Java here so we have this Java you can go to the playlist and here you should have a video on how to install or update Java on Mac so you can watch this video just in case you do not have Java and if Java environment variable is not set and the link is here as well so all these nodes will be available to you so this is the link just in case you want to refer from the nodes you can go directly from here so we need Java the next thing we need Android device so I'm going to use my mobile phone which is an Android mobile you can use any Android device and then we need a cable to connect the mobile device to the computer system in the coming sessions we will also learn how can we do this through Wi-Fi but for now you need a cable that you can connect your mobile device with your laptop or with your computer system and then we also need home view now in case you want to get Android SDK from the from this website you do not need this but just in case you want to use home view so I will just tell you about this do not worry on this let me show you the steps first so the step number one is download android sdk now we can download it from this website which is a website for Android studio so if you go to your browser and say download Android SDK and hit enter you will find this website which is MDOT studio I will go here and here we should have a link to download the command-line tool so this is a website for Android studio and this is a platform to develop Android apps but we do not need that complete platform we just need the Android SDK so if you scroll down you will have a section for command-line tools only and you can get this zip folder for Mac and then you can unzip it so this is one way you can just get it through here or the other way is through Drew so you can say Pew install Android SDK or encase this command does not work you can also save Drew cask install Android SDK so this will also get our Android SDK folder any of this will work in case you are using brew you should install home view and this is the website so and it is always handy to have homebrew if you are using Mac because you can install all your packages and many other packages using home for you so you can see this is a missing package manager for Mac OS and this is the command you just have to copy this command and run this command on your terminal and you will have drew so here I'm going to use this method brew installed Android STK so you can use this brew cask install Android STK and here we have this stack overflow article which will be very useful I will just show you this article so here this is a stack overflow a flow article which shows you how to install Android STK on Mac and you can see these commands here what we are going to use so I will just use this brew install Android STK and let us see what happens so I am running this command on my terminal and it will first update home view and then it will try installing and in case this command does not work I will use the other command which is Drew cask install Android STK so here it is auto updating and it is saying no available formula with the name Android - SDK found a cask named and rod - STK instead so that means we have to use the second command which is brew cask installed Android STK so I will use this let me clear my screen and I will say view cask installed Android STK and this should be able to set our Android STK or installed and yes it is downloading it so it is downloading and then installing Android SDK so this should be fine and you can see this has installed and you can see this is done so this is done it is saying Android STK was successfully installed and I should be able to find it in my user local folder so if I go to this folder user local share I will go to my finder and I will press command shift G on my keyboard and I will see this go to folder and I will go to user local shear and say go and you can see our Android SDK is here and we have the tools so this is something you can also get from the zip folder so if you are following this method of installing or downloading this zip folder you can just unzip and you feel find the same thing here you will find a tools folder and you will find some more folders here so here this was step number one we have downloaded and now we need to extract the platform tools folder so if you see inside tools folder we have a tools folder inside Android SDK and inside the tools folder we have these folders but we do not have any folder called platform tools and this is what we require so if you again go to this website of Android studio and go to user guide here you will see a option a section for command-line tools go here and here you should find a section for SDK manager so go here and here if you scroll down you will find this command so you can extract that from tools and you can extract for any API level so this is for API 28 and just in case you want to check the API level you should go with you can go to Google and search for Android version history and this should show me a Wikipedia page which is for Android version history I will go here and here we should get all our Android version so if I scroll down you can see all the Android version their code name and their API level so for example Android 6 was code named as marshmallow and the API level was 23 and then for Android version 9 we have the code name as PI and API level is 28 and then the latest one at as of this time is Android Q with API level 29 so you can check the Android version for your mobile device and just in case you want to see how to check let me just try to show you if you go to your mobile device so this is my real mobile device and I have used a program called visor through which I can show you the mobile device on the computer screen if you go to settings you will find our option for about phone and you can see about phone is here and you can see the Android version here I am using Android seven one two also you go inside this about phone you will find the Android version which is seven one two now you should use our API level which is above your or equal or above to your Android version so for example I am using seven one two so I should be using API level twenty five or above so if I see here it has given me a command for API level 28 which should work so I will just copy this command and I will also make this available in this notes so that it is easy for you to refer so this is the command and I will run the command here on my terminal so here before you run the command you have to go to the bin folder inside your Android studio folder you will find a bin folder let me show you in a different view and yes so this is my Android STK folder if I go inside this this is tools inside tools I have been and I have SDK manager here so I have to run this command here because it is an SDK manager command so I have to go here and here one of the ways is I can just go to my folder or finder and on SDK manager I will press I will select and press command I on my keyboard and here I will get the link or the location I can copy and I can say CD and space and paste the location and this will change the directory to that bin folder the other way is I will just say CD and space and then I will drag and drop this here and you can see it is going up to SDK manager I do not want up to here I just want to go until bin so now I am on my bin folder and now I will copy the command this command and I will paste it here and say enter and this will start fetching and if I go here you can see you should be getting platform tools here so I will say yes and then turn you can see this is downloading platform tools and you will start seeing these folders here so you can see platform has come and you will also see platform tools in a while so once we have this unzipping complete we will have platform tools folder here and you can see we have got our platform tools and inside platform tools we have all these other programs and folders and files and this is done so we are done with step number two and we have extracted platform tools folder now step number three is we have to add environment variables and route home which should be equal to the location of our Android SDK folder and then we have to append the location of platforms folder platform tools folder in our path environment variable so for that what you can do is I will clear my screen so here you can use this command export and draw at home and the location of your Android SDK folder so I will say export and the name of the variable is Android underscore home equals to the location of our Android SDK folder so if I see here this is the location I can copy it from here and just say like this so I have to only give until Android SDK and say enter and if I say echo dollar Android home it should show me the location also if I say where Android home or I should say which Android home as of now it is not given that because this is not a application which is fine but I should be able to see this variable Android home and this is set to this similarly I have to add the location of platform tools folder so again I will copy the location I will select and press command I and here I will just copy this location I should also go inside one level and then I should press command I so that I should also get platform tools here I will copy this and here now here you have to be very careful do not override anything in the path environment variable we just have to append and for that we have to say export path equals 2 so we will give the location of our platform tools and then a semicolon and then dollar and in curly brackets path and close quote so this is the location and then I have appended Colin dollar path so that means whatever is already there should be already be existing or should all also be copied and then we have to also add this location so I will press ENTER and now if I say echo dollar path you can see in the path environment variables we have all these things plus we now have our platform tools also added so this is how you do it and I will also copy this command so that you can check it here okay so now we have added the location to our environment variables however this is a temporary setup so if I go to a new session of terminal or I open a terminal new tab so I will press command D on my keyboard and you can see this is a new tab here and here if I see here if I say echo dollar Android home you can see there is nothing coming up similarly if I say echo dollar path you can see we do not have the location of our platform tools so that means doing this will only make this available for this temporary session and as soon as I will close the session it will not be available so for that we have to permanently set these paths and for that we have to set it in our bash profile so we have a file called dot bash profile and we have to set it there and this is present in our variant working directory so I will go here I will clear this and I will change directory to my parent working directory and I am inside my opinion directly and if I also say PWD this is the parent working directory and here you can say Kat dot bash profile and you can see this is the file just in case you are not getting it you can create this file using the command touch so here this is the command just in case you do not have you can say touch dot match profile and it will create and then you can check cannot match profile so this is the file where I have to add the variables and the environment variables so for that I will run VI dot bash profile so that it will open in an editor so I will say VI space dot bash profile and now it is here and I will press I on my keyboard so that I go in the insert mode and now you can see I am inside my and I can make the changes here so here I will give this information so whatever you are right after hash will be a comment so here I can just say setting path for Android home and I will use the same command which is this export Android home to this location of Android SDK folder and then I also have to say setting path of platform rules folder or I should say the hair adding I will say adding path of platform tools folder in path environment variable and for that I will use the other command so here this is what I have to say export path equals to the location and at the end colon dollar and in curly brackets path so this is the same thing we did earlier and now to come out I will press escape on my keyboard and then press colon and say the blue q2 right and quit and press X exclamation mark give here a exclamation mark and press ENTER and now I am outside if I now view my dot bash profile file here you can see we have this Android home and then we have platform tools so now if I say echo dollar Android home I am getting this if I say echo dollar path I am getting the location of platform tools and even if I open a new command prompt or a terminal and I say eco dollar and ride home I'm getting this and I say eco dollar path I am still getting that location so here let me just check looks like this is not set here the platform tools I will just go back and check what happened let me just check so if I go to my if I go to my dot bash profile okay I think I do not need to use export and that is something I have written here but I missed that I will again say VI VI dot dash profile and press I to go to the insert mode and I will go to the end of my file and here instead of export path I just need to say path equals this and that's it I will press escape : WQ exclamation and yes so now if I go to any new tab and I say echo dollar path and I should be having the location of platform tools let me check again so I'm checking again I think I missed something here or I will just copy it from here and let me see if there is something I missed this is the location which is fine okay I think this is a problem with this course so because I believe I copied the course it did not copy properly so let me just do this like this and say escape right and quit and now if I see if I say echo dollar path and yes now I can see it is here so that means it is now set properly I will exit from this I will exit from here and I will exit from here as well and here as well so now we have set the location for both our Android home and platform tools in path and I have written all these commands and all this process here so that it is easy for you to follow and after this you can just run the command adb devices just to check that this is working fine so here you can say on your command line or terminal you can say adb devices and here you will not get any list of devices but this command should work so that means every thing is fine all our setup is fine and now the next thing is we have to make our mobile device ready for automation so for this you have to do enable developer mode and then you have to also enable USB debugging so here if I show you my mobile device so you can see my mobile screen and with the help of a program called visor I can show you my mobile screen on my system and here if you go to settings and go to about phone you will find our option for base number you have to tap seven times here so if you tap seven times you will become a developer and you will have develop developer options and as of now in my case it has already set so it is saying no need you are already or developer and after this if you go back to your settings and goto here if you go to settings you will find our option called developer options here so after some time you will see this and if you go inside here you will have an option for USB debugging if it is off you can make it on so you should enable USB debugging and that is what you will do as step number four and now after this step you can connect your mobile device with your laptop or your computer system you using a USB cable or any cable that you use you can just connect it and if you are asked to enable USB debugging on your mobile device allow it enable USB debugging and then after that if you run the command adb devices it should show you your device with a device ID so now you can see it is showing me my device and it is showing me the device ID so if you are able to see this device ID that means you are able to do this correctly all the setup and just a one thing that I missed here is I have checked that if you are having Java 12 these commands do not work properly like this command does not work properly with Java 12 as of now as of this moment so you can just check the Java version I'm using Java 8 I have not checked with Java 9 10 11 but I believe that should work fine so you can just check the Java version and with this you should be able to do this setup so I believe this session was very useful for you thank you for watching
Info
Channel: Automation Step by Step
Views: 60,424
Rating: undefined out of 5
Keywords: how to connect android mobile to mac os, how to connect android on mac, how to do android automation testing on mac, android mobile automation testing, appium automation testing, appium beginner tutorials, appium tutorials for beginners, appium step by step, raghav pal appium tutorials, mobile automation testing tutorials
Id: BEF-d1xjV4Q
Channel Id: undefined
Length: 26min 35sec (1595 seconds)
Published: Sun May 05 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.