How to setup Appium in ubuntu.

Published On: 14 September 2023.By .
  • Mobile
  • Quality Engineering

What is Appium?

Appium is an open-source project and ecosystem of related software, designed to facilitate UI automation of many app platforms, including mobile (iOS, Android, Tizen), browser (Chrome, Firefox, Safari), desktop (macOS, Windows), TV (Roku, tvOS, Android TV, Samsung), and more.

=> Below are the steps to step up appium:-

Step 1 :- Install Java in your system.

Install any version of java you want :- 

  1. Installing openjdk 11 :- 
  •  Run these following commands to install the java 11 :
  •  Once the installation is complete, you can verify it by running the following command:
  • The output should look something like this :

      2. Installing openjdk 8 :- 

  • Run these following commands to install the java 8 :
  •  Once the installation is complete, you can verify it by running the following command:
  •  The output should look something like this :

=> Setting the default version of java : –

  •  If you have multiple Java versions installed on your Ubuntu system you can check which version is set as the default one by typing:
  •  To change the default version, use the update-alternatives command:
  •  The output will look something like below:

Press to keep the current choice[*], or type selection number: 

You will be presented with a list of all installed Java versions. Enter the number of the version you want to be used as the default and press Enter.

Step 2 : – Install Android Studio in your system.

  1. Open “ubuntu software” application in your system.
  2. Search “Android Studio”.
  3. Select the first one and click on “Install” button.
  4. After successful installation , open the application and you will get a pop up of “Import Android Studio Settings” and in that select “Do not import settings” radio button and click on “OK” button.
  5. Now you will get an “Help improve Android Studio” pop up  ->  click on “Don’t send” button.
  6. After that you are on “Android Studio Setup Wizard” window -> click on “Next” button -> select “Standard” install type and  click on “Next” button -> select any UI theme and click on “Next” button  -> again click on “Next” button at Verify Settings page -> click on “Accept” radio button at License Agreement page and click on “Next” button -> click on “Finish” button -> Now the some components will download -> click on “Finish” button.
  7. Now you will be on “Welcome to Android Studio” window  -> click on “More Actions” dropdown  -> select “SDK Manager”.
  8. Now you will be at “Settings” page  -> at “SDK platforms” tab , select Android 12 to Android 8  -> click on “SDK tools” tab and select  Android SDK Build-Tools 34-rc2 , Android SDK Command-line Tools (Latest) , Android Emulator , Android SDK Platform-Tools , Google Web Driver  -> click on “Apply” button  -> click on “OK” button.

Remember :- After all this, In Files you will get an “Android” folder in Home. In that folder you will get all the things you have installed from Android Studio.

Step 3 :- Connection set up in your mobile device.

To set up the connection follow below steps:- 

  1. Connect your mobile device with your system(laptop) through the data cable.
  2. Open your mobile device settings  -> click on “About phone”  -> click on “Software information”  -> click on “Build Number” 7 times to open the     developer options in your mobile device.

Remember :-  The above 2 step is for those users who don’t have the developer options in their mobile device.

    3. Now at settings page, you will get an “Developer options”  -> click on it  -> unable the “USB debugging” mode.

Step 4 :- Installing appium desktop and appium inspector.

  • For appium desktop (server) : – 
  1. Release v1.22.3-4 · appium/appium-desktop · GitHub -> go to this site and download the Appium-server-GUI -linux AppImage.
  2. After successful downloading, go to the files  -> search “Appium -Server” -> open the properties (right click on the AppImage)  -> click on “Permissions” tab  -> select “Allow executing file as program”.
  3. Now double click on downloaded AppImage to open it.
  • For appium inspector :- 
  1. Releases · appium/appium-inspector · GitHub -> go to this site and download the Appium-Inspector-GUI- linux AppImage.
  2. After successful downloading, go to the files  -> search “Appium -Server” -> open the properties (right click on the AppImage)  -> click on “Permissions” tab  -> select “Allow executing file as program”.
  3. Now double click on downloaded AppImage to open it.

Step 5 :- Set up the environment variables in the bash file.

Follow these below steps :- 

  • Open the terminal (ctrl + alt + t)
  • Run this command :-
  • At the end of the page, add all these below variables with their path and save them with  ctrl + shift + s  command :-
  • Close the terminal.

Step 6 :-  Open the Appium Desktop (Server) GUI.

  1. Click on “Edit Configurations” button.
  2. Fill the environment variables with their corresponding path from the bash file ( in which you have create the path variables).
  3. Click on “Save and Restart” button.

Remember :- After clicking on this button, the app will not automatically start.You have to start again manually. 

  • In Host => Enter 127.0.0.1 or  remain at 0.0.0.0 address.
  • In Port => Enter “4723”.
  • Click on “startServer” button.

Step 7 :- Open the Appium Inspector.

Follow the below steps :- 

=> In Appium Server tab :- 

  1. In Remote Host  -> Enter 127.0.0.1 or  remain at 0.0.0.0 address.
  2. In Remote Port -> Enter “4723”.
  3. In Remote Path -> Enter “/wd/hub/”.

=> In Desired Capabilities tab :- 

->  Copy the below json in JSON Representation box and after that click on “save” icon given in the box.                               

Remember :-

a) pVersion (platform version)  -> Change this as per your mobile device android version.

b) udid -> This will different for every device so change this by running the following command in terminal :-

c) appPackage -> This will be only one for each application.

d) appActivity -> There are more than one app Activity for a application.

Note :- In above all desired capabilities, only “udid” and “platformName” are mandatory only to connect your device with appium inspector. To open the particular application, you have to give appPackage and appActivity.

=> Now click on “start session” button.

Note :- If you face any error about Sdk path, close all these applications you have started and start again the appium server and appium inspector.

Related content

That’s all for this blog