HI dear
I have a problem like this.
I’m the first setup appium and use it.
java client code like this:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "934dce40");
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability("appPackage", "com.keda.slmf.magiccube");
capabilities.setCapability("appActivity", ".activity.MainActivity");
AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
String result = driver.findElement(By.id("com.keda.slmf.magiccube.channelbar1:id/show")).getText();
driver.quit();
the appium server error info is:
info: → POST /wd/hub/session {“capabilities”:[{“desiredCapabilities”:{“appPackage”:“com.keda.slmf.magiccube”,“appActivity”:“.activity.MainActivity”,“platformVersion”:“7.1.1”,“automationName”:“Selenium”,“platformName”:“Android”,“deviceName”:“934dce40”}},{“requiredCapabilities”:{}}],“desiredCapabilities”:{“appPackage”:“com.keda.slmf.magiccube”,“appActivity”:“.activity.MainActivity”,“platformVersion”:“7.1.1”,“automationName”:“Selenium”,“platformName”:“Android”,“deviceName”:“934dce40”},“requiredCapabilities”:{}}
info: Client User-Agent string: Apache-HttpClient/4.5.3 (Java/1.8.0_66)
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 2f7637da-00b9-4b42-8214-934de8852371
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_181
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\tool\android\sdk\platform-tools\adb.exe
warn: No app capability, can’t parse package/activity
info: [debug] Set chromedriver binary as: C:\tool\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
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:\tool\android\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device 934dce40
info: [debug] Setting device id to 934dce40
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 wait-for-device
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 25
info: Device API level is: 25
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:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 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:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 push “C:\tool\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 install “C:\tool\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 install “C:\tool\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:\tool\android\sdk\platform-tools\adb.exe -s 934dce40 shell “ps ‘uiautomator’”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
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:
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Command failed:
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Command failed: )”,“killed”:false,“code”:1,“signal”:null,“origValue”:"Command failed: "},“sessionId”:null}
info: ← POST /wd/hub/session 500 16527.668 ms - 192
please help me!!!