Search code examples
javaandroidappium

On Running Appium script showing error : A new session could not be created


Log Flie Attached

info: --> POST /wd/hub/session {"desiredCapabilities":{"appActivity":"com.google.android.launcher.GEL","appPackage":"com.google.android.googlequicksearchbox","platformName":"Android","deviceName":"","platformVersion":""}}

info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_77)

info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device

info: [debug] Creating new appium session 13200b99-4982-4ed9-bed4-7dd89bc865dc info: Starting android appium info: [debug] Getting Java version info: Java version is: 1.8.0_77 info: [debug] Checking whether adb is present info: [debug] Using adb from

C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe

warn: No app capability, can't parse package/activity info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Not checking whether app is present since we are assuming it's already on the device

info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd:

C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe devices

info: [debug] 1 device(s) connected info: Found device 0b01aa5a0298ee0e info: [debug] Setting device id to 0b01aa5a0298ee0e info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)

info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e wait-for-device info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Getting device API level info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "getprop ro.build.version.sdk" info: [debug] Device is at API Level 23 info: Device API level is: 23 info: [debug] Extracting strings for language: default info: [debug] Apk doesn't exist locally info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e shell "rm -rf /data/local/tmp/strings.json" info: [debug] Not uninstalling app since server not started with --full-reset info: [debug] Skipping install since we launched with a package instead of an app path info: [debug] Forwarding system:4724 to device:4724 info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e forward tcp:4724 tcp:4724 info: [debug] Pushing appium bootstrap to device... info: [debug] executing cmd: C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/ info: [debug] Logcat terminated with code 0, signal null info: [debug] Stopping logcat capture info: [debug] Logcat already stopped info: [debug] Sent shutdown command, waiting for UiAutomator to stop... warn: UiAutomator did not shut down fast enough, calling it gone error: Failed to start an Appium session, err was: Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/"

info: [debug] Cleaning up android objects info: [debug] Cleaning up appium session info: [debug] Error: Command failed: C:\Windows\system32\cmd.exe /s /c "C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/"

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created.

(Original error: Command failed: C:\Windows\system32\cmd.exe /s /c \"C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push \"C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar\" /data/local/tmp/\"\n)","killed":false,"code":1,"signal":null,"cmd":"C:\Windows\system32\cmd.exe /s /c \"C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push \"C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar\" /data/local/tmp/\"","origValue":"Command failed: C:\Windows\system32\cmd.exe /s /c \"C:\Users\SAMEER_PWS\AppData\Local\Android\sdk\platform-tools\adb.exe -s 0b01aa5a0298ee0e push \"C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar\" /data/local/tmp/\"\n"},"sessionId":null}

info: <-- POST /wd/hub/session 500 12924.220 ms - 1039


Solution

  • You need to add the path to your .apk file:

    capabilities.setCapability("app", "path to apk");