An unknown server-side error occurred while processing the command

Trying to Automate a hybrid app. I have seem several open issues regarding hybrid app but could not find any solution. I have included the Java Code, Appium log and Eclipse error stack below :

Java Code :
import io.appium.java_client.android.AndroidDriver;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class hybridapp {

public static AndroidDriver driver;

public static void main(String[] args) throws MalformedURLException, InterruptedException {


	
	
	DesiredCapabilities capabilities = new DesiredCapabilities();
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
	capabilities.setCapability("deviceName","Android");
	capabilities.setCapability("platformVersion", "5.0.1");
	capabilities.setCapability("platformName","Android");
      
//	capabilities.setCapability("appPackage", "com.emn8.mobileem8.nativeapp.bk");
	//capabilities.setCapability("appActivity", "com.testfairy.sdk.activities.WelcomeActivity");
	
	
	
	capabilities.setCapability("app","C:\\Users\\bkbc011\\Desktop\\apk\\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk");
	driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	
	
	
	
	
	driver.findElement(By.id("android:id/button1")).click();
	
	Thread.sleep(15000);
	
	

	
	Set<String> contextNames = driver.getContextHandles();
	for (String contextName : contextNames) {
	    System.out.println(contextNames); //prints out something like NATIVE_APP \n WEBVIEW_1
	}
	driver.context((String) contextNames.toArray()[1]); // set context to WEBVIEW_1

/*System.out.println(" it is:"+driver.findElement(By.className(“android.view.View”)).getTagName());

	 Set<String> contextNames = driver.getContextHandles();
        for (String contextName : contextNames) {
            System.out.println(contextName);
            if (contextName.contains("WEBVIEW")){
                 driver.context(contextName);;
                 Thread.sleep(10000);
	
	
            }*/
	
	
         
           driver.findElement(By.className("x-input-text")).getSize();
	
	//driver.findElement(By.className("x-component intro-slide-close x-fit-item")).getSize(); 

//driver.quit();

}
}

Appium Log:

Killed Node Server.
Node Server Process Ended
Starting Node Server
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {“app”:“C:\Users\bkbc011\Desktop\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy.apk”,“address”:“127.0.0.1”,“logNoColors”:true,“androidPackage”:“com.emn8.mobilem8.nativeapp.bk”,“androidActivity”:“com.testfairy.sdk.activities.WelcomeActivity”,“deviceName”:“Nexus4”,“platformName”:“Android”,“platformVersion”:“19”,“automationName”:“Appium”,“language”:“en”}
info: Console LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“app”:“C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk”,“platformVersion”:“5.0.1”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Android”}}
info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
info: [debug] Using local app from desired caps: C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk
info: [debug] Creating new appium session f73e9a59-954a-44d3-960f-653afb851e47
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_31
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe shell “getprop persist.sys.country”
info: [debug] Current device persist.sys.country: US
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 0506931ad84a9331
info: [debug] Setting device id to 0506931ad84a9331
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 wait-for-device
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 21
info: Device API level is: 21
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar “C:\Appium\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk” “C:\Users\bkbc011\AppData\Local\Temp\com.emn8.mobilem8.nativeapp.bk” en
info: [debug] No strings.xml for language ‘en’, getting default strings.xml
info: [debug] java -jar “C:\Appium\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar” “stringsFromApk” “C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk” “C:\Users\bkbc011\AppData\Local\Temp\com.emn8.mobilem8.nativeapp.bk”
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 push “C:\Users\bkbc011\AppData\Local\Temp\com.emn8.mobilem8.nativeapp.bk\strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\bkbc011\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe dump xmltree C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk AndroidManifest.xml
info: [debug] Set app process to: com.emn8.mobilem8.nativeapp.bk
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk.
info: [debug] executing cmd: java -jar C:\Appium\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\bkbc011\AppData\Local\Android\sdk\build-tools\21.1.2\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\build-tools\21.1.2\zipalign.exe -f 4 C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk C:\Users\bkbc011\AppData\Local\Temp\appium115113-7692-79584f.tmp
info: [debug] MD5 for app is 9c31ecc1860732573f4f262a606f84c8
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “ls /data/local/tmp/9c31ecc1860732573f4f262a606f84c8.apk”
info: [debug] Getting install status for com.emn8.mobilem8.nativeapp.bk
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 21
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “pm list packages -3 com.emn8.mobilem8.nativeapp.bk”
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “am force-stop com.emn8.mobilem8.nativeapp.bk”
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “pm clear com.emn8.mobilem8.nativeapp.bk”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 push “C:\Appium\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 install “C:\Appium\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 install “C:\Appium\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“/data/local/tmp”}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “getprop ro.build.version.sdk”
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:false}
info: [debug] Device is at API Level 21
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.emn8.mobilem8.nativeapp.bk/com.testfairy.sdk.activities.WelcomeActivity”
info: [debug] Waiting for pkg “com.emn8.mobilem8.nativeapp.bk” and activity “com.testfairy.sdk.activities.WelcomeActivity” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “dumpsys window windows”
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId f73e9a59-954a-44d3-960f-653afb851e47
info: ← POST /wd/hub/session 303 9723.807 ms - 9
info: → GET /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47 {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“”,“platformVersion”:“5.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk”,“platformVersion”:“5.0.1”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Android”},“app”:“C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk”,“platformName”:“Android”,“deviceName”:“Android”},“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: ← GET /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47 200 4.346 ms - 691 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“”,“platformVersion”:“5.0.1”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“app”:“C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk”,“platformVersion”:“5.0.1”,“browserName”:“”,“platformName”:“Android”,“deviceName”:“Android”},“app”:“C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk”,“platformName”:“Android”,“deviceName”:“Android”},“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: → POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/element {“using”:“id”,“value”:“android:id/button1”}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“id”,“selector”:“android:id/button1”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“android:id/button1”,“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 android:id/button1 using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=android:id/button1]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“1”}}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: ← POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/element 200 810.575 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: → POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/element/1/click {“id”:“1”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“1”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: ← POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/element/1/click 200 915.979 ms - 76 {“status”:0,“value”:true,“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: → GET /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/contexts {}
info: [debug] Getting a list of available webviews
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “cat /proc/net/unix”
info: [debug] WEBVIEW_13564 mapped to pid 13564
info: [debug] Getting process name for webview
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “ps”
info: [debug] Parsed pid: 13564 pkg: com.emn8.mobilem8.nativeapp.bk
info: [debug] from: u0_a232,13564,200,2032036,214384,ffffffff,00000000,S,com.emn8.mobilem8.nativeapp.bk
info: [debug] returning process name: com.emn8.mobilem8.nativeapp.bk
info: [debug] Available contexts:
info: [debug] [“WEBVIEW_com.emn8.mobilem8.nativeapp.bk”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.emn8.mobilem8.nativeapp.bk
info: [debug] Responding to client with success: {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.emn8.mobilem8.nativeapp.bk”],“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: ← GET /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/contexts 200 197.983 ms - 127 {“status”:0,“value”:[“NATIVE_APP”,“WEBVIEW_com.emn8.mobilem8.nativeapp.bk”],“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: → POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/context {“name”:“WEBVIEW_com.emn8.mobilem8.nativeapp.bk”}
info: [debug] Getting a list of available webviews
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “cat /proc/net/unix”
info: [debug] WEBVIEW_13564 mapped to pid 13564
info: [debug] Getting process name for webview
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “ps”
info: [debug] Parsed pid: 13564 pkg: com.emn8.mobilem8.nativeapp.bk
info: [debug] from: u0_a232,13564,200,2037256,215160,ffffffff,00000000,S,com.emn8.mobilem8.nativeapp.bk
info: [debug] returning process name: com.emn8.mobilem8.nativeapp.bk
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.emn8.mobilem8.nativeapp.bk
info: [debug] [“WEBVIEW_com.emn8.mobilem8.nativeapp.bk”]
info: [debug] Available contexts: NATIVE_APP,WEBVIEW_com.emn8.mobilem8.nativeapp.bk
info: [debug] Connecting to chrome-backed webview
info: [debug] Creating Chrome session
info: [debug] Set chromedriver binary as: C:\Appium\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Ensuring Chromedriver exists
info: [debug] Killing any old chromedrivers, running: FOR /F “usebackq tokens=5” %a in (netstat -nao ^| findstr /R /C:"9515 ") do (FOR /F “usebackq” %b in (TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe) do (IF NOT %b==“” TASKKILL /F /PID %b))
info: [debug] No old chromedrivers seemed to exist
info: [debug] Spawning chromedriver with: C:\Appium\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] [CHROMEDRIVER] Starting ChromeDriver (v2.10.267521) on port 9515
Only local connections are allowed.
info: [debug] Making http request with opts: {“url”:“http://127.0.0.1:9515/wd/hub/session",“method”:“POST”,“json”:{“sessionId”:null,“desiredCapabilities”:{“chromeOptions”:{“androidPackage”:“com.emn8.mobilem8.nativeapp.bk”,“androidUseRunningApp”:true,“androidDeviceSerial”:"0506931ad84a9331”}}}}
info: [debug] [CHROMEDRIVER STDERR] [0.003][SEVERE]: Could not bind socket to 127.0.0.1:9515
info: [debug] [CHROMEDRIVER] Port not available. Exiting…
info: [debug] Chromedriver exited with code 1
info: [debug] Chromedriver exited unexpectedly
error: Chromedriver create session did not work. Status was 200 and body was {“sessionId”:“7e458ae9cf33a8b9a0db93ce38055f5c”,“status”:13,“value”:{“message”:“unknown error: Chrome version must be >= 33.0.1750.0\n (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)”}}
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command. (Original error: Did not get session redirect from Chromedriver)”,“origValue”:“Did not get session redirect from Chromedriver”},“sessionId”:“f73e9a59-954a-44d3-960f-653afb851e47”}
info: ← POST /wd/hub/session/f73e9a59-954a-44d3-960f-653afb851e47/context 500 893.767 ms - 280
info: [debug] Didn’t get a new command in 60 secs, shutting down…
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: C:\Users\bkbc011\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0506931ad84a9331 shell “input keyevent 3”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 79.914
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] We shut down because no new commands came in

Error From Eclipse was the code is executed:

[NATIVE_APP, WEBVIEW_com.emn8.mobilem8.nativeapp.bk]
[NATIVE_APP, WEBVIEW_com.emn8.mobilem8.nativeapp.bk]
Exception in thread “main” org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (Original error: Did not get session redirect from Chromedriver) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 899 milliseconds
Build info: version: ‘2.43.1’, revision: ‘5163bce’, time: ‘2014-09-10 16:27:33’
System info: host: ‘BKUSL-6QBN7W1’, ip: ‘172.17.63.87’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_31’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{app=C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=Android, platform=LINUX, desired={app=C:\Users\bkbc011\Desktop\apk\bk-mobile-native-android-app-BKL-2.57.0-SNAPSHOT-aligned-testfairy-7.apk, platformVersion=5.0.1, browserName=, platformName=Android, deviceName=Android}, platformVersion=5.0.1, webStorageEnabled=false, locationContextEnabled=false, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: f73e9a59-954a-44d3-960f-653afb851e47
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:176)
at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:532)
at hybridapp.main(hybridapp.java:53)

I am also facing the same issue. Did you get any sol for this?
Please do reply.

I did. The issue I was having was with google chrome driver. I was not able to fix it but found a workaround with Selendroid. I set the desired capabilities on my code to selendroid and change the automation name on the GUI to Selendroid.
Having said that, I did nothing different but the same code seems to work since Appium 1.4.0 Release. I would suggest you to upgrade Appium if you haven’t already.

looks like this problem still exists in 1.4.13. I added my gist. I’m not sure if anyone has a beat on this. I may play with using my own chromedriver version.
Cheers
Eric

I am able to access elements in webview but not in NATIVE_APP context while running selendroid for my hybrid app. Is anyone able to access native elements?

I found solution on git hub and tried, this solution worked for me atleast in those cases where appium was dying because of changing context, try with latest release of appium 1.4.16:

  1. download chromedriver 2.20 from https://sites.google.com/a/chromium.org/chromedriver/downloads and keep it somewhere like ~/Desktop
  2. give it executable permission like chmod +x ~/Desktop/chromedriver
  3. add capability to driver like :
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(“deviceName”, “Android”);
    capabilities.setCapability(“platformName”, “Android”);
    capabilities.setCapability(“app”, appFile.getAbsolutePath());
    capabilities.setCapability(“serial”, deviceID);
    capabilities.setCapability(“newCommandTimeout”, “120”);
    capabilities.setCapability(“chromedriverExecutable”, “Desktop/tpt/chromedriver”));
    driver = new AndroidDriver(new URL(“http://localhost:4723/wd/hub”), capabilities);
  4. thats it, you should be good now.
1 Like