setValue and sendKeys throw error to set a text in EditText Android

What I try to do in order to test my LoginActivity is to set a text in the email Edittext using Appium and Android Studio.

My 1st version of the test included a WebDriver and a Webelement for the EditText, so i used sendKeys() to set the text.

This is the code:

WebDriver driver;

Before
public void testApp() throws MalformedURLException, InterruptedException {
String apkpath = "C:\\Users\\0013498\\Desktop\\qa-XXX-2-2-4-2.apk";
File app = new File(apkpath);
DesiredCapabilities capabilities= new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME,"Android");
capabilities.setCapability("deviceName","Emulator");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("app",app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.XXX.XXX");
capabilities.setCapability("appActivity", "com.XXX.XXX.SplashScreenActivity");
driver = new AppiumDriver(new URL("http://127.0.0.1:4725/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

}


Test
public void appiumExampleTest() throws Exception {
String path="//android.widget.EditText[contains(@resource-id,\"email\")]";
click(path);
elementSendText(path, "@");
}
public void click(String element) {
WebElement webElement = driver.findElement(By.xpath(element));
webElement.click();
System.out.println("Click element: "+element+" index = "+0);

}


public void elementSendText(String element,  String text) {
WebElement webElement = driver.findElement(By.xpath(element));
webElement.sendKeys(text);

}

BUT sendKeys() throws the following error:

   org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command.          (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 77 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'PC0C283Q', ip: '192.168.0.101', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',     java.version: '1.8.0_76-release'
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{app=C:\Users\0013498\Desktop\qa-XXX-2-2-4-2.apk, appPackage=com.XXX.XXX, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=WKS8DAV8GEYTQGB6, platform=LINUX, appActivity=com.XXX.XXX.SplashScreenActivity, desired={app=C:\Users\0013498\Desktop\qa-interview-2-2-4-2.apk, appPackage=com.XXX.XXX, appActivity=com.XXX.XXX.SplashScreenActivity, platformName=Android, deviceName=Emulator}, platformVersion=6.0, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: 3f61a37c-0f35-487c-be76-97154a8b6e04

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
at io.appium.java_client.DefaultGenericMobileElement.execute(DefaultGenericMobileElement.java:45)
at io.appium.java_client.MobileElement.execute(MobileElement.java:1)
at io.appium.java_client.android.AndroidElement.execute(AndroidElement.java:1)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:98)
at com.cheerle.mongentesting01.test02.elementSendText(test02.java:150)
at com.cheerle.mongentesting01.test02.appiumExampleTest(test02.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true

So, after some digging, i changed my code to start using AndroidDriver and AndroidElement like this:

AndroidDriver driver;
@Before
public void testApp() throws MalformedURLException, InterruptedException {
String apkpath = "C:\\Users\\0013498\\Desktop\\qa-XXX-2-2-4-2.apk";
File app = new File(apkpath);
DesiredCapabilities capabilities= new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME,"Android");
capabilities.setCapability("deviceName","Emulator");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("app",app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.XXX.XXX");
capabilities.setCapability("appActivity", "com.XXX.XXX.SplashScreenActivity");       
driver = new AndroidDriver(new URL("http://127.0.0.1:4725/wd/hub"),capabilities);//<----
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

}
@Test
public void appiumExampleTest() throws Exception {
AndroidElement emailET= (AndroidElement)driver.findElementById("com.XXX.XXX:id/email");//<----
emailET.click();//<----
emailET.setValue("@");
}

and now, setValue() throws the following error:

   org.openqa.selenium.WebDriverException: Not yet implemented.

maybe build.gradle has sth to do with the issue?

 apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.cheerle.mongentesting01"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'
    compile files('libs/java-client-5.0.0-BETA3.jar')
    compile files('libs/selenium-server-standalone-3.0.1.jar')
}

what am i missing? this should not be that difficult.

I am using AndroidDriver and I got the same thing when trying to execute:

WebElement txtPassword = driver2.findElementById("password");
txtPassword.sendKeys("test321321");