title: Unable to perform any operation on real device using appium for native app automation
body: <p>I am trying to use Appium for testing calculator app (Just for knowledge purpose). But I am not able to perform any operation. Below is the details: <br>
  Real Mobile: Xiaomi Redmi Note 3 <br>
  Android version: 6.0.1 <br>
  MIUI: 8.1 <br>
  Appium version: 1.4.16 <br>
  Android SDK version: 24.4.1 <br>
  appium java-client: 4.1.2 <br>
  Code:</p>
  
  <pre><code>package unittest;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.URL;
  import java.util.Properties;
  import org.junit.Test;
  import org.openqa.selenium.By;
  import org.openqa.selenium.remote.DesiredCapabilities;
  import io.appium.java_client.MobileElement;
  import io.appium.java_client.android.AndroidDriver;
  import io.appium.java_client.remote.MobileCapabilityType;
  
  public class LaunchWardRobe {
  
      @Test
      public void swipeTest() throws IOException {
          String propFileName = "wardrobe.properties";
          InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(propFileName);
          Properties prop = new Properties();
          prop.load(inputStream);
          DesiredCapabilities cap = new DesiredCapabilities();
          cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, prop.getProperty("cap.platform.version"));
          cap.setCapability(MobileCapabilityType.PLATFORM_NAME, prop.getProperty("cap.platform.name"));
          cap.setCapability(MobileCapabilityType.DEVICE_NAME, prop.getProperty("cap.device.name"));
          cap.setCapability("appPackage", prop.getProperty("cap.app.package"));
          cap.setCapability("appActivity", prop.getProperty("cap.app.activity"));
          cap.setCapability(MobileCapabilityType.BROWSER_NAME, "");
          cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
          AndroidDriver&lt;MobileElement&gt; browser = new AndroidDriver&lt;MobileElement&gt;(
                  new URL(prop.getProperty("cap.hub.url")), cap);
          MobileElement dig5 = browser.findElement(By.id("com.miui.calculator:id/btn_5"));
          dig5.tap(1, 3);
          dig5.click();
          browser.closeApp();
      }
  }
  </code></pre>
  
  <p>Properties File:</p>
  
  <pre><code>cap.platform.version=6.0.1
  cap.platform.name=Android
  cap.device.name=Redmi
  cap.app.package=com.miui.calculator
  cap.app.activity=com.miui.calculator.cal.CalculatorActivity
  cap.hub.url=http://127.0.0.1:4723/wd/hub
  </code></pre>
  
  <p>Exception or stacktrace on the Eclipse Console IDE: </p>
  
  <pre><code>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: 410 milliseconds
  Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
  System info: host: 'mrunal-laptop', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
  Driver info: io.appium.java_client.android.AndroidDriver
  Capabilities [{appPackage=com.miui.calculator, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=80b83390, platform=LINUX, appActivity=com.miui.calculator.cal.CalculatorActivity, desired={appPackage=com.miui.calculator, appActivity=com.miui.calculator.cal.CalculatorActivity, platformVersion=6.0.1, automationName=Appium, browserName=, platformName=Android, deviceName=Redmi}, platformVersion=6.0.1, webStorageEnabled=false, locationContextEnabled=false, automationName=Appium, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
  Session ID: caa419ad-6146-47e0-a1b1-ef700d6645e6
      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:206)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
      at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
      at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
      at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
      at io.appium.java_client.AppiumDriver.performTouchAction(AppiumDriver.java:336)
      at io.appium.java_client.MultiTouchAction.perform(MultiTouchAction.java:71)
      at io.appium.java_client.AppiumDriver.tap(AppiumDriver.java:361)
      at io.appium.java_client.MobileElement.tap(MobileElement.java:50)
      at unittest.LaunchWardRobe.swipeTest(LaunchWardRobe.java:33)
      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.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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>
  
  <p>Appium Logs:</p>
  
  <pre><code>info: [debug] Appium session started with sessionId caa419ad-6146-47e0-a1b1-ef700d6645e6 info: &lt;-- POST /wd/hub/session 303 10720.889 ms - 74  info: --&gt; GET /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6 {} info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"com.miui.calculator","appActivity":"com.miui.calculator.cal.CalculatorActivity","platformVersion":"6.0.1","automationName":"Appium","browserName":"","platformName":"Android","deviceName":"Redmi"},"appPackage":"com.miui.calculator","appActivity":"com.miui.calculator.cal.CalculatorActivity","automationName":"Appium","platformName":"Android","deviceName":"80b83390"},"sessionId":"caa419ad-6146-47e0-a1b1-ef700d6645e6"} info: &lt;-- GET /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6 200 1.228 ms - 700 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"6.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"appPackage":"com.miui.calculator","appActivity":"com.miui.calculator.cal.CalculatorActivity","platformVersion":"6.0.1","automationName":"Appium","browserName":"","platformName":"Android","deviceName":"Redmi"},"appPackage":"com.miui.calculator","appActivity":"com.miui.calculator.cal.CalculatorActivity","automationName":"Appium","platformName":"Android","deviceName":"80b83390"},"sessionId":"caa419ad-6146-47e0-a1b1-ef700d6645e6"} info: --&gt; POST /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6/element {"using":"id","value":"com.miui.calculator:id/btn_5"} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.miui.calculator:id/btn_5","context":"","multiple":false}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.miui.calculator:id/btn_5","context":"","multiple":false}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: find info: [debug] [BOOTSTRAP] [debug] Finding com.miui.calculator:id/btn_5 using ID with the contextId:  multiple: false info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.miui.calculator:id/btn_5] info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}} info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"caa419ad-6146-47e0-a1b1-ef700d6645e6"} info: &lt;-- POST /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6/element 200 82.020 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"caa419ad-6146-47e0-a1b1-ef700d6645e6"} info: --&gt; POST /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6/touch/perform {"actions":[{"action":"press","options":{"element":"1"}},{"action":"wait","options":{"ms":3}},{"action":"release","options":{}}]} info: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"1"}] info: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"1"}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"1"}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":270,"y":1317}} info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"1"}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getSize info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":270,"height":201}} info: [debug] Pushing command to appium work queue: ["element:getLocation",{"elementId":"1"}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"1"}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation info: [debug] Pushing command to appium work queue: ["element:getSize",{"elementId":"1"}] info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"x":270,"y":1317}} info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"1"}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getSize info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"width":270,"height":201}} info: [debug] Pushing command to appium work queue: ["element:touchDown",{"elementId":"1","x":405,"y":1417.5}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:touchDown","params":{"elementId":"1","x":405,"y":1417.5}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: touchDown info: [debug] [BOOTSTRAP] [debug] Performing TouchDown using element? true x: 405, y: 1417 info: [debug] [BOOTSTRAP] [error] error while invoking method private boolean com.android.uiautomator.core.InteractionController.touchDown(int,int) on object com.android.uiautomator.core.InteractionController@358f4be with parameters [405, 1417] null info: [debug] [BOOTSTRAP] [debug] Problem invoking touchDown: java.lang.RuntimeException: error while invoking method private boolean com.android.uiautomator.core.InteractionController.touchDown(int,int) on object com.android.uiautomator.core.InteractionController@358f4be with parameters [405, 1417] info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Failed to execute touch event"},"sessionId":"caa419ad-6146-47e0-a1b1-ef700d6645e6"} info: &lt;-- POST /wd/hub/session/caa419ad-6146-47e0-a1b1-ef700d6645e6/touch/perform 500 358.523 ms - 198  info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":13,"value":"Failed to execute touch event"}
  </code></pre>