Setup Android and Genymotion into Eclips and Automation Testing with Appium

Good Artical to step by step setup –

Download Appium

Before download and install appium in windows, Please make sure bellow given prerequisites are fulfilled.

  1. JDK Installed. View
  2. Android SDK Installed.
  3. Set ANDROID_HOME and Path Environment Variables.
  4. Eclipse ADT Plugin Installed.
  5. Microsoft .Net Framework, Node JS and PDANet+ for Android Installed.

1.Install the Java JDK and set JAVA_HOME to your JDK folder

  • Download from
  • It opens Java SE Development Kit 8 Downloads page. Download jdk-8u31-window-i58.exe and install it
  • Set JAVA_HOME Variable in your windows system environment variable ex. Select advanced tab -> Click on Environment Variables button. It will open Environment Variables dialog.
  • Set Path Variable For Java

2. Install the Android SDK

  1. Download SDK from
  2. Set ANDROID_HOME to be your Android SDK path and add the tools and platform-tools folders to your PATH variable.


  1. Need to run the ‘android’ tool (included in the SDK) and make sure you have an API Level 17 or greater API installed. Run “ddms” batch file


Download Genymotion

  • Open
  • Login in
  • Go to Download page and download Genymotion latest version (i.e. 2.8.0) with VirtualBox. It will download the exe (i.e. genymotion-2.8.0.exe)
  • Now run the setup. It will install to default location (C:\Program Files\Genymobile\Genymotion)

Setup plugin in Eclipse

  • Start Eclipse, then select Help > Install New Software.
  • Click Add, in the top-right corner.
  • In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location:

Install Genymotion plugin into Eclipse

  • Open Eclipse > Help > Install New Software
  • Add Location URL

For Genymotion –


  • Click OK.
  • In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  • In the next window, you’ll see a list of the tools to be downloaded. Click Next.
  • Read and accept the license agreements, then click Finish.
  • If you get a security warning saying that the authenticity or validity of the software can’t be established, click OK.

For Genymotion setup the Preferences in Eclips Window > Preference


Install Node JS

Download Windows Installer (.msi) file as per your system(32 bit or 64 bit)

Capture the Logcat

Option 1 : From Eclipse once you open the emulator we can see the Logs in Logcat Go to Eclipse > Window > Show View > Other and select “LogCat” Eclipse_Logcat Eclipse_Logcat1

Option 2 : Generate the LogCat file From Command prompt (Once set path\platform-tools

Windows: adb logcat –d > %UserProfile%\Desktop\ellowoyld.txt

Windows: set timestamp=%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~0,2%%time:~3,2%%time:~6,2%adb logcat –d > “%UserProfile%\Desktop\%timestamp%-logcat.txt” Or

Create .bat file

1) Open notepad, or whatever your preferred text editor is (just not word or an rtf text editor)

2) Paste in your commands: set timestamp=%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~0,2%%time:~3,2%%time:~6,2% adb logcat –d >”%UserProfile%\Desktop\%timestamp%-logcat.txt” adb logcat –c 3) And save it to your desktop as a “.bat” file with a catchy name

Appium Architecture


In above figure mention that Client is any IDE (ex. Eclipse) where we write the code to automate an application So client would communicate to Server and Server understand what client will request and communicate with Mobile devices.

Appium is web-server. It follows the client- server architecture. Client would be communicating to server and server would be perform the necessary actions.

Client is initiates the Session. So client would be sending something calls as Desired Capabilities to the server so that server will understand what kind of session does it needs to create. This particular Server would responds back on same Session ID. This session id would be use for all further communication going to made between the client and server.

Appium is returns in Node.js. Appium understand each and every request that is coming form the client so communication is done over the http protocol it uses something call as communication between client and server is done by JSON Wire Protocol. Which means client written in any programming language like JAVA, Ruby, Python etc. and server understand what to do with client request and communicate with mobile devices and response back to client.

Appium communicate with iOS called as UIAutomation. if Android version less than 17, Appium communicate with Android called as Instrumentation and if Android version grater than 17, Appium communicate with Android by UiAutomator.

Appium is an open source, cross-platform test automation tool for native, hybrid and mobile web apps, tested on simulators (iOS, FirefoxOS), emulators (Android), and real devices (iOS, Android, FirefoxOS).

Note – Appium Support from Android API 17 means Support from Android 4.2.2

Setup Appium download the JDK, Android SDK, Eclips setup Java and JDK path in environment (Verify in cmd Java -version) setup Android Path Download Appium exe, nodejs Start Appium server – Option 1 – Open appium.exe Option 2 – cmd > go to C:\Program Files (x86)\Appium\node_modules\appium\bin > node appium

  • Download SDK and set-up environment variable

Download android-sdk zip file for window or Mac OS


Extract zip file and Click on SDK Manager.exe

Set up the Environment Variables and path

ANDROID_HOME D:\android-sdk-windows

Add D:\android-sdk-windows\platform-tools and D:\android-sdk-windows\tools under  path after semicolon(;)

Open cmd and type ‘adb’ to test it

  • Download and Setup Nodejs

run .msi only it will automatically detect and set the path

  • Download Appium

Just run the appium-installer setup or run appium server it will automatically download latest version

  • Download Java Client

Click on Java link under Appium Client Libraries

Download jar ex. 3.4.1

  • PDANet(optional)

User-full to identify the missing driver to connect your mobile device with PC via USB

  • Download Genymotion


Install APK in mobile device

Run your virtual device or connect mobile device with USB

Open cmd and type adb devices to see connected device


now type commend ‘adb install <apkpath> <Filename.apk>’ to install apk in connected device


Setup the test apk path in appium before start it


Once Start appium server package and launch activity value set and disable


click on start button on right top corner Find the webelement and xpath from uiautomatorview open the cmd > uiautomatorviewer

How to find the Webelement or xpath of application using uiautomatorview 

Open application in emulator or in real device and start uiautomatorviewer

Press the Device Screen shot button on top2



Create Appium First Test project in Eclips (





public class desiredcapb


public AndroidDriver driver;


public void setUp() throws MalformedURLException


File appDir = new Faile(“src”); File app = new File(appDir, “app.apk”); DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID); cap.setCapability(MobileCapabilityType.DEVICE_NAME, MobileDevices.find(“emulator-5554”)); cap.setCapability(MobileCapabilityType.APP_PACKAGE, “”); cap.setCapability(MobileCapabilityType.APP_ACTIVITY,””); driver = new AndroidDriver(new URL(“;), cap);



public void test() throws Exception { WebElement btn_me = driver.findElement(“bottomBarMeButton”));;



How to find APP_PACKAGE and APP_ACTIVITY for apk file

  1. Download and install SDK.
  2. Inside SDK Manager download Tools (Android SDK build-tools) and APIs for recent versions of Android.
  3. Open SDK folder and go to build-tools folder.
  4. Open any folder (example: 21.1.2).
  5. Open a command prompt window in this folder ( Shift+ right click – Open command window here).
  6. Run command “aapt list -a <path_to_apk_we_need_to_test> >manifest.txt” ( this command will write the app manifest in manifest.txt file inside the same folder).
  7. Open the manifest.txt txt file.
  8. At the beginning of the file there should be details about the package including name ( example:
  9. At the end of the file there should be details about activity including name ( example: ContactManager).

appium3 appium4


Install and Run the application in emulator

Open hierarchyviewer.bat from android-sdk\tools

You can see application APK package and main activity to use in script



from Command prompt – Open your application in Device or in Emulator – type command > adb shell >  dumpsys window windows | grep -E ‘mCurrentFocus|mFocused App’ It will give you your application package and main activity of current applicaton e.x   mCurrentFocus=Window{11266800 u0 com.cns.rd/com.realtydaddy.ui.user.AuthenticationActivity}

So APP_PACKAGE = com.cns.rd and APP_ACTIVITY = com.realtydaddy.ui.user.AuthenticationActivity

public void ValidLoginTest() throws Exception {
WebElement Login = driver.findElement(“authActivity_btn_SignIn”));;
WebElement LoginUserName = driver.findElement(“fragSignIn_et_emailOrUserName”));
WebElement LoginPassword = driver.findElement(“fragSignIn_et_password”));
WebElement SignIn = driver.findElement(“fragSignIn_btn_SignIn”));;


Issue : Using uiautomatorviewer to quickly get resource-ids as mention in above code but noticed that sometime resource-id field is no longer present in uiautomatorviewer

Solutions : Visibility of the resource id is dependent on Adnroid version. Its supported from Android version 4.3 or later/ from API level 18.

Reference Tutorial


About samp79

Professional Automation Tester
This entry was posted in Android, Appium. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s