代码用的官网的 AndroidContactsTest.java
模拟器本身安装 apk 正常
当前系统 windows 7
appium 版本 AppiumForWindows-0.17.6
运行脚本后,出现如下错误,
E:\shouji\Appium\node_modules\appium\bin>node appium.js -a127.0.0.1 -p4723 -Uemu
lator-5554 --full-reset
info: Welcome to Appium v0.17.6 (REV 7b32947e166a4338047f31ac14457c2b0eb432aa)
info: Appium REST http interface listener started on 127.0.0.1:4723
info - socket.io started
info: Non-default server args: {"udid":"emulator-5554","address":"127.0.0.1","fu
llReset":true,"merciful":true}
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"WINDOWS
","app":"D:\workspace\test2\apps\ContactManager.apk","browserName":"","app-p
ackage":"com.example.android.contactmanager","device":"Android","app-activity":"
.ContactManager","version":"4.3"}}
warn: [DEPRECATED] The device capability has been deprecated and will be removed
. Please use the platformName capability instead.
warn: [DEPRECATED] The version capability has been deprecated and will be remove
d. Please use the platformVersion capability instead.
info: Using local app from desired caps: D:\workspace\test2\apps\ContactManager.
apk
info: Creating new appium session 2c945cd2-e33d-4b0f-9226-a90e05dba61b
info: Starting android appium
debug: Using fast reset? false
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from E:\shouji\android-sdk_r22.6-windows\android-sdk-windo
ws\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" devices
info: [ADB] 1 device(s) connected
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (tim
eout = 5)
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 wait-for-device
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: Starting logcat capture
info: Getting device API level
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: Device is at API Level 18
debug: java -jar "E:\shouji\Appium\node_modules\appium\lib\devices\android\helpe
rs\strings_from_apk.jar" "D:\workspace\test2\apps\ContactManager.apk" "C:\Window
s\Temp\com.example.android.contactmanager"
warn: Error getting strings.xml from apk
debug: 'java' is not recognized as an internal or external command,
operable program or batch file.
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 shell "echo '{}' > E:\data\local\tmp\strings
.json"
info: Checking whether aapt is present
info: [ADB] Using aapt from E:\shouji\android-sdk_r22.6-windows\android-sdk-wind
ows\build-tools\19.0.1\aapt.exe
debug: processFromManifest: "E:\shouji\android-sdk_r22.6-windows\android-sdk-win
dows\build-tools\19.0.1\aapt.exe" dump xmltree D:\workspace\test2\apps\ContactMa
nager.apk AndroidManifest.xml
warn: ERROR: dump failed because resource AndroidManifest.xml found
debug: Set app process to: .contactmanager
info: Uninstalling com.example.android.contactmanager
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 uninstall com.example.android.contactmanager
debug: App was not uninstalled, maybe it wasn't on device?
info: MD5 for app is d4127191869a404fb9f23f7bc7af914a
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/d4127191869a404fb9
f23f7bc7af914a.apk"
debug: Getting install status for com.example.android.contactmanager
debug: executing: "E:\shouji\android-sdk_r22.6-windows\android-sdk-windows\platf
orm-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.example.andro
id.contactmanager"
info: [ADB] App is not installed
debug: Checking app cert for D:\workspace\test2\apps\ContactManager.apk: java -j
ar "E:\shouji\Appium\node_modules\appium\lib\devices\android\helpers\verify.jar"
"D:\workspace\test2\apps\ContactManager.apk"
debug: App not signed with debug cert.
debug: Resigning apk with: java -jar "E:\shouji\Appium\node_modules\appium\lib\d
evices\android\helpers\sign.jar" "D:\workspace\test2\apps\ContactManager.apk" --
override
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Sent shutdown command, waiting for UiAutomator to stop...
warn: UiAutomator did not shut down fast enough, calling it gone
info: Cleaning up android objects
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: 'java'
is not recognized as an internal or external command,
operable program or batch file.
info: Error: Command failed: 'java' is not recognized as an internal or external
command,
operable program or batch file.
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: Responding to client with error: {"status":33,"value":{"message":"A new se
ssion could not be created. (Original error: Command failed: 'java' is not recog
nized as an internal or external command,\r\noperable program or batch file.\r\n
)","killed":false,"code":1,"signal":null,"origValue":"Command failed: 'java' is
not recognized as an internal or external command,\r\noperable program or batch
file.\r\n"},"sessionId":null}
POST /wd/hub/session 500 11744ms - 436b