Environment Setup:
Preconditions:
Steps to set Path on windows OS: Right Click “My Computer”. “Properties” On left panel “Advance System Settings” Select Environment Variables System Variables-> Type Path-> “Path” double click Enter the path to JAVA jdk in your system followed by (;) then path to your android sdk (;) path to your android platform (;) path to your android platform tools-> Click OK.
Steps to install Eclipse Plug-in for Android: 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: https://dl-ssl.google.com/android/eclipse/ Click OK (If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
Steps to set ANDROID_HOME variable: Go to Eclipse->Window on top panel->Preferences-> Double click Android on left panel In the Android preferences, Copy the SDK Location Right Click “My Computer”. “Properties” On left panel “Advance System Settings” Select Environment Variables On the top User Variables-> Select new-> Variable Name, Enter ANDROID_HOME, Variable Path-> Enter copied SDK location from Eclipse-> Click OK Then System Variables-> Select new-> Variable Name, Enter ANDROID_HOME, Variable Path-> Enter copied SDK location from Eclipse-> Click OK Exit
Launching Appium:
Following should be displayed: info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe) info: Appium REST http interface listener started on 0.0.0.0:4723 info: Console LogLevel: debug info: Appium REST http interface listener started on 0.0.0.0:4723info: Console LogLevel: debug
Write a Program to launch Appium in Eclipse: package appium.com;
import java.net.MalformedURLException; import java.net.URL;
import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver;
public class AppiumLaunch { public static void main(String args[]) throws MalformedURLException { RemoteWebDriver driver; DesiredCapabilities capabilities =new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName","");
capabilities.setCapability("version","4.4.2");
capabilities.setCapability("device ID","");
capabilities.setCapability("app-package","");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("app-activity","");
capabilities.setCapability("takesScreenshot",true);
capabilities.setCapability("app","C:/Users/.......apk");
driver=new RemoteWebDriver( new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
System.out.println("app is launched on the device");
}
}
Steps to launch appium for android: