It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible


#1

Hi Guys,

I am using appium java client: 6.1.0
Appium Server: 1.8.1
facing below issue please help me to resolve it.

FAILED CONFIGURATION: @BeforeTest setUp
org.openqa.selenium.WebDriverException: It is impossible to create a new session because ‘createSession’ which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: ‘3.13.0’, revision: ‘2f0d292’, time: ‘2018-06-25T15:24:21.231Z’

This is my code:
public class NewTest {
AndroidDriver driver;
@BeforeTest
public void setUp() throws MalformedURLException{
//Set up desired capabilities and pass the Android app-activity and app-package to Appium
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“BROWSER_NAME”, “Android”);
capabilities.setCapability(“VERSION”, “6.1”);
capabilities.setCapability(“deviceName”,“Samsung”);
capabilities.setCapability(“platformName”,“Android”);
capabilities.setCapability(“appPackage”, “com.android.calculator2”);
// This package name of your app (you can get it from apk info app)
capabilities.setCapability(“appActivity”,“com.android.calculator2.Calculator”); // This is Launcher activity of your app (you can get it from apk info app)
//Create RemoteWebDriver instance and connect to the Appium server
//It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
URL url= new URL(“http://127.0.0.1:4723/wd/hub”);

	driver = new AndroidDriver<WebElement>(url, capabilities);
	driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
@Test
public void testCal() throws Exception {
   //locate the Text on the calculator by using By.name()
   WebElement two=driver.findElement(By.name("2"));
   two.click();
   WebElement plus=driver.findElement(By.name("+"));
   plus.click();

}

@AfterClass
public void teardown(){
	//close the app
	driver.quit();
}

}


#2

Hi, I’m facing the same issue randomly for tests… Sometimes they succeed, sometimes they fail to start with this error.
I’m working with Appium 1.7.2 and Java_Client 6.1


#3

Me too facing the issue . Could any one look help on this.
Appium Server:1.6.2
Appium v1.8.1
client: Java-Client-6.1.0
Selenium: 3.13.0

Attached Log
[Appium] Welcome to Appium v1.8.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {“desiredCapabilities”:{“appActivity”:“com.amazon.micron.GatewayActivity”,“appPackage”:“in.amazon.mShop.android.shopping”,“noReset”:“true”,“platformVersion”:“5.1”,“platformName”:“Android”,“udid”:“BH905RC60M”,“deviceName”:“Sony”},“capabilities”:{“alwaysMatch”:{“appium:appActivity”:“com.amazon.micron.GatewayActivity”,“appium:appPackage”:“in.amazon.mShop.android.shopping”,“appium:deviceName”:“Sony”,“appium:noReset”:“true”,“platformName”:“android”,“appium:platformVersion”:“5.1”,“appium:udid”:“BH905RC60M”},“firstMatch”:[{}]}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“appActivity”:“com.amazon.micron.GatewayActivity”,“appPackage”:“in.amazon.mShop.android.shopping”,“noReset”:“true”,“platformVersion”:“5.1”,“platformName”:“Android”,“udid”:“BH905RC60M”,“deviceName”:“Sony”},null,{“alwaysMatch”:{“appium:appActivity”:“com.amazon.micron.GatewayActivity”,“appium:appPackage”:“in.amazon.mShop.android.shopping”,“appium:deviceName”:“Sony”,“appium:noReset”:“true”,“platformName”:“android”,“appium:platformVersion”:“5.1”,“appium:udid”:“BH905RC60M”},“firstMatch”:[{}]}]
[BaseDriver] Event ‘newSessionRequested’ logged at 1533449478876 (11:41:18 GMT+0530 (India Standard Time))
[BaseDriver] Boolean capability passed in as string. Functionality may be compromised.
[Appium] Creating new AndroidDriver (v2.7.0) session
[Appium] Capabilities:
[Appium] platformName: android
[Appium] appActivity: com.amazon.micron.GatewayActivity
[Appium] appPackage: in.amazon.mShop.android.shopping
[Appium] deviceName: Sony
[Appium] noReset: true
[Appium] platformVersion: 5.1
[Appium] udid: BH905RC60M
[BaseDriver] W3C capabilities {“alwaysMatch”:{“platformNa… and MJSONWP desired capabilities [object Object] were provided
[BaseDriver] Creating session with W3C capabilities: {“alwaysMatch”:{“platformNa…
[BaseDriver] Boolean capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability ‘noReset’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 4d13204c-0e3e-4093-bc27-7a4b9702afe4
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_181
[ADB] Checking whether adb is present
[ADB] Found 1 ‘build-tools’ folders under ‘C:\Android’ (newest first):
[ADB] C:/Android/build-tools/28.0.1
[ADB] Using adb.exe from C:\Android\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices…
[ADB] 1 device(s) connected
[AndroidDriver] Using device: BH905RC60M
[ADB] Setting device id to BH905RC60M
[AndroidDriver] App file was not listed, instead we’re going to run in.amazon.mShop.android.shopping directly on the device
[AndroidDriver] Checking whether package is present on the device
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell pm list packages in.amazon.mShop.android.shopping’
[AndroidDriver] Starting Android session
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M wait-for-device’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell echo ping’
[AndroidDriver] Pushing settings apk to device…
[ADB] Getting install status for io.appium.settings
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell pm list packages io.appium.settings’
[ADB] App is installed
[ADB] Getting package info for ‘io.appium.settings’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell dumpsys package io.appium.settings’
[ADB] Checking whether aapt is present
[ADB] Using aapt.exe from C:\Android\build-tools\28.0.1\aapt.exe
[ADB] The installed ‘io.appium.settings’ package does not require upgrade (‘2.3.0’ >= ‘2.3.0’)
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell ps’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell getprop ro.build.version.sdk’
[ADB] Current device property ‘ro.build.version.sdk’: 22
[ADB] Device API level: 22
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell am start -W -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’
[ADB] Device API level: 22
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell settings put secure mock_location 1’
[AndroidDriver] setDeviceLanguageCountry requires language or country.
[AndroidDriver] Got language: ‘undefined’ and country: ‘undefined’
[Logcat] Starting logcat capture
[AndroidDriver] Pushing unlock helper app to device…
[ADB] Getting install status for io.appium.unlock
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell pm list packages io.appium.unlock’
[ADB] App is installed
[ADB] Getting package info for ‘io.appium.unlock’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell dumpsys package io.appium.unlock’
[ADB] The installed ‘io.appium.unlock’ package does not require upgrade (‘2.0.0’ >= ‘2.0.0’)
[ADB] Getting device platform version
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell getprop ro.build.version.release’
[ADB] Current device property ‘ro.build.version.release’: 5.1.1
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell wm size’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell getprop ro.product.model’
[ADB] Current device property ‘ro.product.model’: C6903
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell getprop ro.product.manufacturer’
[ADB] Current device property ‘ro.product.manufacturer’: Sony
[AndroidDriver] No app sent in, not parsing package/activity
[AndroidDriver] No app capability. Assuming it is already on the device
[AndroidBootstrap] Watching for bootstrap disconnect
[ADB] Forwarding system: 4724 to device: 4724
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M forward tcp:4724 tcp:4724’
[UiAutomator] Starting UiAutomator
[UiAutomator] Moving to state ‘starting’
[UiAutomator] Parsing uiautomator jar
[UiAutomator] Found jar name: ‘AppiumBootstrap.jar’
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M push ‘C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-android-bootstrap\bootstrap\bin\AppiumBootstrap.jar’ /data/local/tmp/’
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell ps’
[ADB] No uiautomator process found to kill, continuing…
[UiAutomator] Starting UIAutomator
[ADB] Creating ADB subprocess with args: [”-P”,5037,"-s",“BH905RC60M”,“shell”,“uiautomator”,“runtest”,“AppiumBootstrap.jar”,"-c",“io.appium.android.bootstrap.Bootstrap”,"-e",“pkg”,“in.amazon.mShop.android.shopping”,"-e",“disableAndroidWatchers”,false,"-e",“acceptSslCerts”,false]
[UiAutomator] Moving to state ‘online’
[AndroidBootstrap] Android bootstrap socket is now connected
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell dumpsys window’
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Registered crash watchers.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[AndroidDriver] Screen already unlocked, doing nothing
[ADB] Device API level: 22
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell am start -W -n in.amazon.mShop.android.shopping/com.amazon.micron.GatewayActivity -S’
[AndroidDriver] Shutting down Android driver
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell am force-stop in.amazon.mShop.android.shopping’
[ADB] Pressing the HOME button
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell input keyevent 3’
[AndroidBootstrap] Sending command to android: {“cmd”:“shutdown”}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“shutdown”}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
[AndroidBootstrap] Received command result from bootstrap
[UiAutomator] Shutting down UiAutomator
[UiAutomator] Moving to state ‘stopping’
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1

[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.

[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner

[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer

[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap

[AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[UiAutomator] UiAutomator shut down normally
[UiAutomator] Moving to state ‘stopped’
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting all processes with uiautomator
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell ps’
[ADB] No uiautomator process found to kill, continuing…
[UiAutomator] Moving to state ‘stopped’
[Logcat] Stopping logcat capture
[ADB] Running ‘C:\Android\platform-tools\adb.exe -P 5037 -s BH905RC60M shell am force-stop io.appium.unlock’
[AndroidDriver] Not cleaning generated files. Add clearSystemFiles capability if wanted.
[BaseDriver] Event ‘newSessionStarted’ logged at 1533449487529 (11:41:27 GMT+0530 (India Standard Time))
[W3C] Encountered internal error running command: Error: Cannot start the ‘in.amazon.mShop.android.shopping’ application. Original error: The permission to start ‘com.amazon.micron.GatewayActivity’ activity has been denied.Make sure the activity/package names are correct.
[W3C] at ADB.callee$0$0$ (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:125:11)
[W3C] at tryCatch (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[W3C] at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[W3C] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[W3C] at GeneratorFunctionPrototype.invoke (C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[W3C] at
[HTTP] <-- POST /wd/hub/session 500 8682 ms - 1750
[HTTP]
Appium server stopped successfully


#4

Even i am also encountering same error


#5

Faced the same error today. The problem was in connecting Appium to adb. Check if your PATH to SDK is correct


#6

Same problem here. My adb command is correctly pathed.


#7

same issue, any update ?


#8

same issue,

It is impossible to create a new session because ‘createSession’ which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’
System info: host: ‘Vinoths-MacBook-Pro-4.local’, ip: ‘fe80:0:0:0:1caa:fda1:2027:1f4c%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.1’, java.version: ‘1.8.0_191’
Driver info: driver.version: AppiumDriver


#9

Im also facing the same error.


#10

Still Facing This issue in Android 7.0 with Appium 1.9.1 and Appium-Java 6.1.0
Please help me to resolve it.


#11

I am facing the same issue

org.openqa.selenium.WebDriverException: Connection refused (Connection refused)
Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’
System info: host: ‘Suaads-MacBook-Pro.local’, ip: ‘fe80:0:0:0:1ce6:21b1:d16e:3e5e%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.14.4’, java.version: ‘1.8.0_191’
Driver info: driver.version: AndroidDriver