android app is not launched after Running appium script using java for sauce labs

I am new to saucelabs. I dont how to install appium java client and how to excute java test script file through which command? Can anybody help to me?Got confused with many commands and tutorials. I am using eclipse and java to run appium script to lauch android application in sauce labs.I have included external jar files (required jars for testNG,java client appium,junit ,saucerest,-1.0.26).When i run the script as testNg application,it gives result.But The application is not launched after logging in saucelabs.The TestNg result is attached as file.The script is

public class sampAppium {

    public AndroidDriver driver; // RemoteWebDriver driver1;

    @Before
    public void setUp() throws Exception { // set up appium

        String apkURL = "sauce-storage:Report.apk";
        String sauceUserName = "gkyrreport";
        String sauceAccessKey = "e4f*****************8eeed6638";

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("deviceName", "Android Emulator");
        capabilities.setCapability("platformVersion", "4.4");
        capabilities.setCapability("app", apkURL);
        capabilities.setCapability("appPackage", "com.android-app");
        capabilities.setCapability("appActivity", ".MainActivity"); // driver1 = new RemoteWebDriver(new URL(MessageFormat.format("http://{0}:{1}@ondemand.saucelabs.com:80/wd/hub",sauceUserName, sauceAccessKey)), capabilities);

        URL sauceURL = new URL("https://"; + sauceUserName + ":" + sauceAccessKey + "@ondemand.saucelabs.com:80/wd/hub");
        driver = new AndroidDriver(sauceURL, capabilities);

        System.out.println("App launched successfully");
    }

    @After public void tearDown() throws Exception {
        driver.quit();
    }

    @Test public void testUIComputation() throws Exception {
        WebElement button = driver.findElementByClassName("UIAButton");
        button.click();
    }

    public String getSessionId() {
        return getSessionId();
    }


Source: eclipse

Leave a Reply