同样的代码,appium版本1.15.1,真机不报错,模拟器报错Error: Failed to launch Appium Settings app: Condition unmet after 5115 ms. Timing out.
下面是日志:
[Appium] Welcome to Appium v1.15.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {“capabilities”:{“firstMatch”:[{“appium:deviceName”:“192.168.56.105:5555”,“appium:app”:"/Users/zy/工作/JCSample公版1.19/JCSample_2.apk",“appium:appPackage”:“com.juphoon.cloud.sample”,“appium:appActivity”:".MainActivity",“platformName”:“Android”,“appium:noReset”:“true”}]},“desiredCapabilities”:{“deviceName”:“192.168.56.105:5555”,“app”:"/Users/zy/工作/JCSample公版1.19/JCSample_2.apk",“appPackage”:“com.juphoon.cloud.sample”,“appActivity”:".MainActivity",“platformName”:“Android”,“noReset”:“true”}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{“deviceName”:“192.168.56.105:5555”,“app”:"/Users/zy/工作/JCSample公版1.19/JCSample_2.apk",“appPackage”:“com.juphoon.cloud.sample”,“appActivity”:".MainActivity",“platformName”:“Android”,“noReset”:“true”},null,{“firstMatch”:[{“appium:deviceName”:“192.168.56.105:5555”,“appium:app”:"/Users/zy/工作/JCSample公版1.19/JCSample_2.apk",“appium:appPackage”:“com.juphoon.cloud.sample”,“appium:appActivity”:".MainActivity",“platformName”:“Android”,“appium:noReset”:“true”}]}]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1572933044597 (13:50:44 GMT+0800 (GMT+08:00))
[Appium]
[Appium] ======================================================================
[Appium] DEPRECATION WARNING:
[Appium]
[Appium] The ‘automationName’ capability was not provided in the desired
[Appium] capabilities for this Android session
[Appium]
[Appium] Setting ‘automationName=UiAutomator2’ by default and using the
[Appium] UiAutomator2 Driver
[Appium]
[Appium] The next major version of Appium (2.x) will require the
[Appium] ‘automationName’ capability to be set for all sessions on all
[Appium] platforms
[Appium]
[Appium] In previous versions (Appium <= 1.13.x), the default was
[Appium] ‘automationName=UiAutomator1’
[Appium]
[Appium] If you wish to use that automation instead of UiAutomator2, please
[Appium] add ‘automationName=UiAutomator1’ to your desired capabilities
[Appium]
[Appium] For more information about drivers, please visit
[Appium] http://appium.io/docs/en/about-appium/intro/ and explore the
[Appium] ‘Drivers’ menu
[Appium]
[Appium] ======================================================================
[Appium]
[Appium] Appium v1.15.1 creating new AndroidUiautomator2Driver (v1.37.2) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] “alwaysMatch”: {
[debug] [BaseDriver] “platformName”: “Android”,
[debug] [BaseDriver] “appium:deviceName”: “192.168.56.105:5555”,
[debug] [BaseDriver] “appium:app”: “/Users/zy/工作/JCSample公版1.19/JCSample_2.apk”,
[debug] [BaseDriver] “appium:appPackage”: “com.juphoon.cloud.sample”,
[debug] [BaseDriver] “appium:appActivity”: “.MainActivity”,
[debug] [BaseDriver] “appium:noReset”: “true”
[debug] [BaseDriver] },
[debug] [BaseDriver] “firstMatch”: [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Capability ‘noReset’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: b1a25f66-1010-4eec-b481-7c9fbbefba5f
[BaseDriver] Using local app ‘/Users/zy/工作/JCSample公版1.19/JCSample_2.apk’
[debug] [UiAutomator2] Checking whether app is actually present
[ADB] Found 1 ‘build-tools’ folders under ‘/Users/zy/android-sdk-macosx’ (newest first):
[ADB] /Users/zy/android-sdk-macosx/build-tools/29.0.2
[ADB] Using ‘adb’ from ‘/Users/zy/android-sdk-macosx/platform-tools/adb’
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices…
[debug] [ADB] Connected devices: [{“udid”:“192.168.56.105:5555”,“state”:“device”}]
[AndroidDriver] Using device: 192.168.56.105:5555
[ADB] Using ‘adb’ from ‘/Users/zy/android-sdk-macosx/platform-tools/adb’
[debug] [ADB] Setting device id to 192.168.56.105:5555
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell getprop ro.build.version.sdk’
[debug] [ADB] Current device property ‘ro.build.version.sdk’: 21
[debug] [ADB] Device API level: 21
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 wait-for-device’
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell echo ping’
[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell dumpsys package io.appium.settings’
[debug] [ADB] ‘io.appium.settings’ is not installed
[debug] [ADB] App ‘/usr/local/lib/node_modules/appium/node_modules/_io.appium.settings@2.14.2@io.appium.settings/apks/settings_apk-debug.apk’ is not installed
[debug] [ADB] Installing ‘/usr/local/lib/node_modules/appium/node_modules/_io.appium.settings@2.14.2@io.appium.settings/apks/settings_apk-debug.apk’
[debug] [ADB] Skipping permissions grant option, since the current API level 21 does not support applications permissions customization
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell ‘ls -t -1 /data/local/tmp/appium_cache 2>&1 || echo ERROR’’
[debug] [ADB] The current Android API does not support extended ls options. Defaulting to no-options call
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell ‘ls /data/local/tmp/appium_cache 2>&1 || echo ERROR’’
[debug] [ADB] Got an error ‘/data/local/tmp/appium_cache: No such file or directory’ while getting the list of files in the cache. Assuming the cache does not exist yet
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell mkdir -p /data/local/tmp/appium_cache’
[debug] [ADB] The count of applications in the cache: 0
[ADB] Caching the application at ‘/usr/local/lib/node_modules/appium/node_modules/_io.appium.settings@2.14.2@io.appium.settings/apks/settings_apk-debug.apk’ to ‘/data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk’
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell mkdir -p /data/local/tmp/appium_cache’
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 push /usr/local/lib/node_modules/appium/node_modules/_io.appium.settings@2.14.2@io.appium.settings/apks/settings_apk-debug.apk /data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk’
[ADB] The upload of ‘settings_apk-debug.apk’ (1.16 MB) took 0.069s
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pm install /data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk’
[ADB] The installation of ‘settings_apk-debug.apk’ took 1.288s
[debug] [ADB] Install command stdout: pkg: /data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk
[debug] [ADB] Success
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell ‘pgrep --help; echo $?’’
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[AndroidDriver] Granting android.permission.SET_ANIMATION_SCALE, CHANGE_CONFIGURATION, ACCESS_FINE_LOCATION by pm grant
[debug] [ADB] Granting permissions [“android.permission.SET_ANIMATION_SCALE”,“android.permission.CHANGE_CONFIGURATION”,“android.permission.ACCESS_FINE_LOCATION”] to ‘io.appium.settings’
[debug] [ADB] Got the following command chunks to execute: [[“pm”,“grant”,“io.appium.settings”,“android.permission.SET_ANIMATION_SCALE”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.CHANGE_CONFIGURATION”,";",“pm”,“grant”,“io.appium.settings”,“android.permission.ACCESS_FINE_LOCATION”,";"]]
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pm grant io.appium.settings android.permission.SET_ANIMATION_SCALE ; pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION ; pm grant io.appium.settings android.permission.ACCESS_FINE_LOCATION ;’
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell pgrep ^appium\.settings$’
[AndroidDriver] Failed to launch Appium Settings app: Condition unmet after 5115 ms. Timing out.
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 shell am force-stop com.juphoon.cloud.sample’
[debug] [ADB] Removing forwarded port socket connection: 8200
[debug] [ADB] Running ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 forward --remove tcp:8200’
[UiAutomator2] Unable to remove port forward ‘Error executing adbExec. Original error: ‘Command ‘/Users/zy/android-sdk-macosx/platform-tools/adb -P 5037 -s 192.168.56.105:5555 forward --remove tcp:8200’ exited with code 1’; Stderr: ‘adb: error: listener ‘tcp:8200’ not found’; Code: ‘1’’
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1572933053731 (13:50:53 GMT+0800 (GMT+08:00))
[debug] [W3C] Encountered internal error running command: Error: Failed to launch Appium Settings app: Condition unmet after 5115 ms. Timing out.
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:127:9)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at spin (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:122:14)
[debug] [W3C] at waitForCondition (/usr/local/lib/node_modules/appium/node_modules/_asyncbox@2.6.0@asyncbox/lib/asyncbox.js:129:10)
[debug] [W3C] at Object.pushSettingsApp (/usr/local/lib/node_modules/appium/node_modules/_appium-android-driver@4.20.1@appium-android-driver/lib/android-helpers.js:578:5)
[debug] [W3C] at Object.initDevice (/usr/local/lib/node_modules/appium/node_modules/_appium-android-driver@4.20.1@appium-android-driver/lib/android-helpers.js:733:5)
[debug] [W3C] at AndroidUiautomator2Driver.startUiAutomator2Session (/usr/local/lib/node_modules/appium/node_modules/_appium-uiautomator2-driver@1.37.2@appium-uiautomator2-driver/lib/driver.js:305:23)
[debug] [W3C] at AndroidUiautomator2Driver.createSession (/usr/local/lib/node_modules/appium/node_modules/_appium-uiautomator2-driver@1.37.2@appium-uiautomator2-driver/lib/driver.js:211:7)
[debug] [W3C] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:353:35)
[HTTP] <-- POST /wd/hub/session 500 9206 ms - 709
老师,装了很多不同的模拟器,试了不同的Android版本,但是大部分会报这种错误。可以帮我找找是什么错误吗,检查过模拟器网络好的,appium代码执行后模拟器上可以看到appium setting这个app