Appium Beginner Tutorial 5 | How To Connect Real Android Mobile Device On Windows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome I'm Rocco and today we are going to learn how to connect a real Android device on Windows so that we can use it for our automation and I am going to go very basic step-by-step so do not worry if this is the first time or you are doing this or you do not have any prior knowledge on this topic this is going to be very easy and very interesting and before I go to the steps let me also tell you about the prerequisites so here we have this prerequisite I will also copy this and take it to the top and all these notes will be available to you so do not worry all these notes will be available to you so here the prerequisites are we should have Java installed on the system and Java home environment variables should be set on the system and to check this you can go to the command line and run this command so for example if I go to my command line I will say Java space hyphen version so this is the command Java space hyphen version and if you run this command you will get the version of Java on your system let me just check yes it is version 8 installed on my system and you can also check Java compiler version by running the command Java C space hyphen version and you can see it is installed on my system now just in case Java is not installed on your system you can go to my channel on YouTube which is YouTube forward slash automation step-by-step and if you go here you will find a playlist here go to the playlist and when you scroll down you will have a playlist for Java go to the Java playlist and here we have a session video on how to install Java on windows so you can watch this just in case Java is not installed on your system or Java home environment variables are not set so you can go and watch that video I will also make the link available in this node so let me just copy the link from here and I will make it available here so that it is very handy for you and you can definitely from here now after that we need a mobile Android device or any mobile Android device maybe your phone will work our connecting cable so our connecting cable to connect your mobile device to the computer and we need at least 100 MB to 1gb of free space so the folder that we are going to download the SDK folder is around 150 MB so we need at least 200 MB however if you do not have at least 1 GB it can make the process slow so let us say we should have at least 1 GB of free space so these are the few cassettes now the first step is we have to download the SDK tools or SDK manager so for that you can go to google and search for download Android studio now do not worry I am NOT going to download Android studio it's just the SDK tools that we need so if you go here and this is the link I will also make this link available in the notes so you have to download it from this link and when you go here this is for Android studio we do not need Android studio this is used for development of Android apps we will scroll down and if you go down you will have a section for command-line tools only and here you can get the command-line tools for windows so this is for Windows you can click on this and it will give you this agreement to accept and you can accept and download and it will start downloading a zipped folder so you can see it is downloading for now I will just cancel this because I already have it and let me just show you I have this zipped folder here which is downloaded from Android studio website and now I will extract this or unzip it so I will say extract all and you can put this at any location on your system and I will also change the name so that it is easy to reference and I will name this as Android - SDK and I'm putting it on my desktop itself so I will say extract and you can see it is extracting on this folder so let's just wait for this extraction to be completed and then I will show you the next step just to show you here so we have done step number one which is download this SDK tools and now we are doing step number two which is unzip folder and extract platform tools now you will not find platform tools directly inside the folder and this is what we have to accept and this is what I am just going to show you and also this entire process of conducting a real Android device on Windows is a separate process it is not linked to a pium so whether you have a PM installed on your system or not it is not it will not impact this process this is a completely separate process so you may install apium before this or after this if you are doing a PM automation but this is a completely separate process so we are doing step number two as of now and let me just go back and it is still unzipping so this unzip can take some time based on your system configuration and speed and this is going to be done and yes it is done and you can see we have our tools folder inside this folder so let me just go from here I will go to this Android SDK folder which I have unzipped and here we have our tools folder and inside tools we have some other folders however we cannot see platform tools and that is what we need so we should be having SDK manager so you can see here you will have SDK manager let me go inside bin folder and inside when you can see we have a SDK manager dot bat file so this is a Windows batch file and this is what we will use to extract or download the platform tools so if you go back to your browser and here on Android studio website you will have this user guide so let us go to this user guide and here if you scroll down we have a section for command line tools go here and then if we scroll down we have a section here for SDK manager go to SDK manager and here you can see this is our documentation for SDK manager so this is a command line tool that looks tall update and uninstall packages for the Android SDK and now if you go a little more down you will find the package is an sdk style path as shown with the list and here we have this command this is the command you can pass multiple package paths so this is the command we need to use and this will extract platform tools and you can use an API number based on your Android so if you go to google and search for android versions and if you go to this Wikipedia page and route version history and you scroll down you can see these are all the Android versions their code name their version number and then the API level so for example you have Android 6 it is marshmallow the code name is marshmallow and then the API number is 23 and similarly if you are using Android 8 you can see the API number here or APA level here now you can just check the Android version on your mobile device so let me just show you if I show you the screen of my mobile device so I'm using this software called visor and this helps to show your mobile screen on your computer desktop and yes so you can see it here and to just check the Android version on your phone you can go to settings here and if you go to about phone you can see it is already showing Android version which is 7.1.2 and if you go inside about phone it will show you all the details and you can see this is the Android version 7.1.2 which is there on my mobile device so here I can select the APA level accordingly and on this command so this is the command I will copy this command so for seven one two if you see here four hundred seven one two the AP level is 24 to 25 so I can actually put 24 or 25 instead of 28 here however our higher APA level should work for lower Android version so I will just copy this command and I will also put it in the nodes so this is the command that you have to run and this you have to run on command line you have to go to bin folder and then run this command so if you go to your folder here this is the Android SDK folder you have to go to this location on command line so you can copy this location and then I'll just copy this location from here and go to your command line and here I will say CD and then paste the location so I can do like this or another way is you can just go to this address bar and say CMD and hit enter and it will open command line on the same location so you can see it has opened my command line on the same location and here I will run this particular command in this command I will copy and run it on command line so this should extract platform tools and that platform tools should be available inside the Android SDK folder now you may face some issues here so you can check your java version when i install java 12 on my system this command was not working and now I have Java 8 on my system and now this is working so you can just accept say yes and enter and it will start downloading platform tools so as I was saying you can also in case it does not work you can check your java version if it is 12 it might not work because as of now it was not working Java 12 on my system I have Java 8 I have not checked with Java 9 10 or 11 versions in case you are using any of this version and it works for you you can put this down in the comment section that Java 9 is working or Java 10 is working or Java 11 is also working so that it is useful for others for now I am using Java 8 and this command is working fine with Java 8 so this is now installing and unzipping and we will have platform tools folder so if I now go to my folder again so if I now go to my folder Android SDK you can see this platform is here and platform tools will also come in some time so let's just wait for platform tools as well so this is now unzipping and you can see we also have platform tools now so we have platforms and platform tools folder here and let this process get completed as of now this is 76% and now this is done so now we have both our folders here and if I go back to my notes so we have done second step now so step number 2 is done now we have to set environment variables now this is important we have to set to environment variables first one is Android home and this should be equal to the folder location of your SDK folder so whatever name you have given in my case I have given Android SDK so this folder and then we have to set the path for so there is a environment variable called path and we have to append the path of platform tools folder here so these are the two things we have to do so if I go to this folder Android SDK so this location I will create a new environment variable now you can either search for environment variables and you will get option to edit system environment variable so you can go from here or you can also do a right click on my computer or this PC so if you do a right-click here you can go to properties and go to advanced system settings and go to environment variables so either way you can go and now here these are the environment variables specific for the particular user who is the user on this system and this is for system variables so I'm just going to add to system variable so that it is available for all the users I will click new and create a variable name Android underscore home and provide the location of my Android SDK folder and say ok and now I will search for path so path environment variable should already be present and you will now click on edit so click on edit and here you do not have to change anything which is already existing you have to add it at the end now just in case if you have an older version of Windows you might find this in a text box view in that case what we are going to do is you can just go to the end of whatever is already there so for example there will be a text box and there will be some data already there so you have to go at the end just give a semicolon and then give the location of the folders so for example this is the location of platform tools so you will just copy this location and after semicolon just provide your location and you can give a semicolon or just leave it like this so this is for the older versions where you do not see something like this if you are having Windows 10 and you have a similar view then you can just go to new and add your folder location and say ok and ok so now we have also done step number 3 which is set environment variables and now you can check adb devices command on command-line now if you go to your command line and open a new command line because the older open command line will have the older session so go to a new command line and now here if you run it P devices and say enter so it shows a list of devices so in my case I already have a device attached so it is showing but do not worry if you are not seeing anything the only thing to verify here is that this command does not shows you any error or does not says that adb does not exist so that's the only thing that you have to do so let me just disconnect my device and I have as of now disconnected my device or I have I have taken out the cable and now if I say adb devices you can see nothing is there it is not showing any device connected so here you have to check this command on command-line adb devices and adb stands for Android debug bridge so this is something we used to check our devices installed now the next step is step number five is make we have to make our device ready so that it can be connected to our system now here at this moment you will connect your device with a USB cable or with any cable that you have and before you do that before actually you connect your device you have to do some settings so you have to enable developer mode on your system and make USB debugging on now how to do that let me show you I will show you my mobile device and this is my mobile device and you can see with the help of visor I am able to show you the screen of my mobile device on desktop so you will go to settings as of now there is no need to connect your device to the system just go to your mobile device open your mobile and go to settings and here go to about phone and inside about phone you will have a option called bridge number now you have to tap seven times here so start tapping and five seventh time you will become a developer or the developer mode will be enabled so in my case it is already done so it is showing you are already a developer otherwise you will just tap seven times and it will enable developer and then if you go back to your settings after some time you will have developer options here you can see this option developer options go inside developer options and now you will have our option here for USB debugging so he can see this option USB debugging make this on I will not make this off because if I make this off this screen will go away so I will keep it on and you can also make this on if it is off you can enable it and now this is how you will set up or enable your mobile device and then once you have done this you can connect the device to computer using a cable with either a USB cable or whatever cable you use to connect your mobile device to your computer you can use that so I am will now connect my device to the computer system and when you connect on your mobile device you might get this question or option to enable USB debugging or you might get a prompt to enable USB debugging so you can allow it and now once you have allowed USB debugging and your an developer mode is also enabled and your USB debugging is on then if you run ADB devices on your command line it should show you your device so now if I go and just say adb devices and run this it is showing me a list of device attached is showing me one of the device and this is the device ID so now we are able to connect our device to Windows system which we can now use for further for automation or we can use with APM so in the coming sessions I will show you how exactly now you can use for automation and this process of connecting a Android device on Windows this is a completely separate process it has nothing to do with APM at this moment even if you have a PM or you do not have this will work fine so this is how you can connect your mobile device I hope this session was useful for you thank you for watching
Info
Channel: Automation Step by Step
Views: 146,571
Rating: undefined out of 5
Keywords: appium how to connect real android device on windows, how to connect real mobile device, mobile real device automation testing, adb devices, windows adb devices command not working, how to add sdk manager on windows, how to get platform tools folder on windows, how to extract platform tools from sdk manager, appium beginner tutorials, appium tutorials for beginners, learn appium step by step, appium by raghav, raghav pal, automation step by step, vysor mobile
Id: 82KXSli1wPA
Channel Id: undefined
Length: 20min 2sec (1202 seconds)
Published: Fri May 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.