0

I want to launch Appium with Android emulator on Windows. I want to test ApiDemo.apk.

The following graphic shows my Appium GUI configuration:

enter image description here

The following graphic shows my starting emulator:

enter image description here

The following code is showing my JUnit test case:

import java.net.URL;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

public class AppiumAndroidTest {
    private AppiumDriver<WebElement> driver;  

    @Before  
    public void setUp() throws Exception {  
        DesiredCapabilities capa = new DesiredCapabilities();

        capa.setCapability("automationName","Appium"); 
        capa.setCapability("platformName","Android");
        capa.setCapability("deviceName","Nexus_5");
        capa.setCapability("platformVersion","23");
        capa.setCapability("newCommandTimeout","30");
        capa.setCapability("unicodeKeyboard", true);
        capa.setCapability("resetKeyboard", true);    
        capa.setCapability("app", "C:\\Android\\SDK\\apps\\ApiDemos.apk");

        driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capa);
    }  

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


    @Test  
    public void testScriptGoesHere() throws Exception {
        System.out.println("Test start");

        System.out.println("Test end");
    }  
}

Now I receive this error in Appium GUI log:

> Nexus_5
> info: [debug] Emulator Nexus_5 not running
> info: [debug] Trying to find Nexus_5 emulator
> info: [debug] Getting connected emulators
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: C:\Android\SDK\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: [debug] 1 emulator(s) connected
> info: [debug] Sending telnet command to device: avd name
> info: [debug] Getting running emulator port
> info: [debug] Socket connection to device created
> info: [debug] Socket connection to device ready
> info: [debug] Telnet command got response: a[K[Dav[K[D[Davd[K[D[D[Davd [K[D[D[D[Davd n[K[D[D[D[D[Davd na[K[D[D[D[D[D[Davd nam[K[D[D[D[D[D[D[Davd name[K

So can anyone tell me how to fix this?

Greets!

Steve Murdock
  • 709
  • 1
  • 10
  • 20
  • could you share more from the appium server logs and whats the error that you have faced over these? – Naman Apr 12 '16 at 18:38
  • I have the same scenario running in Appium 1.4.16.1 in Windows. Tried to revert back to Android 1.5.2 but maybe I would have to go back to 1.5.1. It looks like the 1.5.2 has the 2.0 emulator and getting the same issue posted above. > info: [debug] executing cmd: C:\Users\jparulan\AppData\Local\Android\Sdk\platform-tools\adb.exe devices > info: [debug] 1 device(s) connected > info: [debug] 1 emulator(s) connected > info: [debug] Sending telnet command to device: avd name > info: [debug] Getting running emulator port > info: [debug] Socket connection to device created > info: [debug] Socket conn – Jeff Parulan May 27 '16 at 15:35

1 Answers1

0

Seems to there some issue. I was able to resolve it by unchecking the checkbox "Launch AVD". ie:- Click on Play button to stop the Appium from GUI and uncheck the "Launch AVD" field and start Appium server back. It should work now.

nibu.b
  • 21
  • 2