问答 请问 appium 启动 app 失败,问题在哪呢?

srw123 · 2022年05月11日 · 最后由 Jacky 回复于 2022年05月12日 · 5433 次阅读

[Appium] Appium v1.15.1 creating new AndroidUiautomator2Driver (v1.37.2) session
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] "alwaysMatch": {
[BaseDriver] "platformName": "Android",
[BaseDriver] "appium:platformVersion": "9",
[BaseDriver] "appium:deviceName": "d4d59027",
[BaseDriver] "appium:appPackage": "tv.danmaku.bili",
[BaseDriver] "appium:appActivity": ".ui.splash.SplashActivity",
[BaseDriver] "appium:unicodeKeyboard": true,
[BaseDriver] "appium:resetKeyboard": true,
[BaseDriver] "appium:noReset": true,
[BaseDriver] "appium:newCommandTimeout": 6000,
[BaseDriver] "appium:automationName": "UiAutomator2"
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] Session created with session id: 3632f540-9add-43dd-9a9c-c15b6bf3bdbe
[UiAutomator2] Starting 'tv.danmaku.bili' directly on the device
[ADB] Using 'adb.exe' from 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] Connected devices: [{"udid":"d4d59027","state":"device"}]
[AndroidDriver] Looking for a device with Android '9'
[ADB] Setting device id to d4d59027
[ADB] Getting device platform version
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 9
[AndroidDriver] Using device: d4d59027
[ADB] Using 'adb.exe' from 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[ADB] Setting device id to d4d59027
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 28
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 9
[ADB] Device API level: 28
[UiAutomator2] Relaxing hidden api policy
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings put global hidden_api_policy_pre_p_apps 1'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings put global hidden_api_policy_p_apps 1'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings put global hidden_api_policy 1'
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 wait-for-device'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys package io.appium.settings'
[ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\emulator\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\tools\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\tools\bin\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.0.0\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'C:\Users\RuiWen\AppData\Local\Android\Sdk'?
[ADB] Using 'aapt.exe' from 'C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\aapt.exe'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('2.14.2' >= '2.14.2')
[ADB] There is no need to install/upgrade 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell 'pgrep --help; echo $?''
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell pgrep -f io\.appium\.settings'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell pgrep -f io\.appium\.settings'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell pgrep -f io\.appium\.settings'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell appops set io.appium.settings android:mock_location allow'
[Logcat] Starting logcat capture
[AndroidDriver] Enabling Unicode keyboard support
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings get secure default_input_method'
[AndroidDriver] Unsetting previous IME com.sohu.inputmethod.sogou.vivo/.SogouIME
[AndroidDriver] Setting IME to 'io.appium.settings/.UnicodeIME'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell ime enable io.appium.settings/.UnicodeIME'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell ime set io.appium.settings/.UnicodeIME'
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys package io.appium.uiautomator2.server'
[ADB] Cannot extract apk info using apkanalyzer. Falling back to aapt. Original error: Could not find 'apkanalyzer.bat' in ["C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\emulator\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\tools\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\tools\bin\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\apkanalyzer.bat","C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.0.0\apkanalyzer.bat"]. Do you have Android Build Tools installed at 'C:\Users\RuiWen\AppData\Local\Android\Sdk'?
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.3.0' >= '4.3.0')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk
[ADB] Using 'apksigner.bat' from 'C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\apksigner.bat'
[ADB] Starting 'C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\apksigner.bat' with args '["verify","--print-certs","C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' is already signed.
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
[ADB] Starting 'C:\Users\RuiWen\AppData\Local\Android\Sdk\build-tools\32.1.0-rc1\apksigner.bat' with args '["verify","--print-certs","C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk"]'
[ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[ADB]
[ADB] 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk' is already signed.
[UiAutomator2] Server packages are not going to be (re) installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 forward tcp:8200 tcp:6790'
[UiAutomator2] No app capability. Assuming it is already on the device
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (Error: socket hang up)
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 4.3.0
[UiAutomator2] Using UIAutomator2 server from 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.3.0.apk' and test from 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","d4d59027","shell","am","instrument","-w","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
[WD Proxy] Got response with status 200: {"sessionId":"None","value":{"ready":true,"message":"UiAutomator2 Server is ready to accept commands"}}
[UiAutomator2] The initialization of the instrumentation process took 4213ms
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8200/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"9","deviceName":"d4d59027","appPackage":"tv.danmaku.bili","appActivity":".ui.splash.SplashActivity","unicodeKeyboard":true,"resetKeyboard":true,"noReset":true,"newCommandTimeout":6000,"automationName":"UiAutomator2"},"platformName":"Android","platformVersion":"9","deviceName":"d4d59027","appPackage":"tv.danmaku.bili","appActivity":".ui.splash.SplashActivity","unicodeKeyboard":true,"resetKeyboard":true,"noReset":true,"newCommandTimeout":6000,"automationName":"UiAutomator2","deviceUDID":"d4d59027"}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"sessionId":"ec9a1fca-bf82-4c9b-b76d-bbe5932dee87","value":{"sessionId":"ec9a1fca-bf82-4c9b-b76d-bbe5932dee87","capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","platformVersion":"9","deviceName":"d4d59027","appPackage":"tv.danmaku.bili","appActivity":".ui.splash.SplashActivity","unicodeKeyboard":true,"resetKeyboard":true,"noReset":true,"newCommandTimeout":6000,"automationName":"UiAutomator2"},"platformName":"Android","platformVersion":"9","deviceName":"d4d59027","appPackage":"tv.danmaku.bili","appActivity":".ui.splash.SplashActivity","unicodeKeyboard":true,"resetKeyboard":true,"noReset":true,"newCommandTimeout":6000,"automationName":"UiAutomator2","deviceUDID":"d4d59027"}],"alwaysMatch":{}}}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[WD Proxy] Proxying [GET /appium/device/info] to [GET http://localhost:8200/wd/hub/session/ec9a1fca-bf82-4c9b-b76d-bbe5932dee87/appium/device/info] with no body
[WD Proxy] Got response with status 200: {"sessionId":"ec9a1fca-bf82-4c9b-b76d-bbe5932dee87","value":{"androidId":"59e40d056a14b98d","manufacturer":"vivo","model":"V1928A","brand":"vivo","apiVersion":"28","platformVersion":"9","carrierName":"CHN-CT","realDisplaySize":"720x1544","displayDensity":320,"networks":[{"type":0,"typeName":"MOBILE","subtype":13,"subtypeName":"LTE","isConnected":true,"detailedState":"CONNECTED","state":"CONNECTED","extraInfo":"IMS","isAvailable":true,"isFailover":false,"isRoaming":false,"capabilities":{"transportTypes":"NET_CAPABILITY_MMS","networkCapabilities":"","linkUpstreamBandwidthKbps":0,"linkDownBandwidthKbps":79285,"signalStrength":-2147483648,"networkSpecifier":"3","SSID":null}},{"type":1,"typeName":"WIFI","subtype":0,"subtypeName":"","isConnected":true,"detailedState":"CONNECTED","state":"CONNECTED","extraInfo":null,"isAvailable":true,"isFailover":false,"isRoaming":false,"capabilities":{"transportTypes":"NET_CAPABILITY_SUPL","networkCapabilities":"","linkUpstreamBandwidthKbps":1048576,"linkDownBandwidthKbps":1048...
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] Starting 'tv.danmaku.bili/.ui.splash.SplashActivity and waiting for 'tv.danmaku.bili/.ui.splash.SplashActivity'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell am start -W -n tv.danmaku.bili/.ui.splash.SplashActivity -S'
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/ec9a1fca-bf82-4c9b-b76d-bbe5932dee87] with no body
[WD Proxy] Got response with status 200: {"sessionId":"ec9a1fca-bf82-4c9b-b76d-bbe5932dee87","value":null}
[UiAutomator2] Resetting IME to 'com.sohu.inputmethod.sogou.vivo/.SogouIME'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell ime set com.sohu.inputmethod.sogou.vivo/.SogouIME'
[Instrumentation] .
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell am force-stop tv.danmaku.bili'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 forward --remove tcp:8200'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings delete global hidden_api_policy_pre_p_apps'
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings delete global hidden_api_policy_p_apps'
[Instrumentation] Time: 3.057
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
[ADB] Running 'C:\Users\RuiWen\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s d4d59027 shell settings delete global hidden_api_policy'
[BaseDriver] Event 'newSessionStarted' logged at 1652255993249 (15:59:53 GMT+0800 (中国标准时间))
[W3C] Encountered internal error running command: Error: Cannot start the 'tv.danmaku.bili' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name '.ui.splash.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
[W3C] at ADB.startApp (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:153:11)
[HTTP] <-- POST /wd/hub/session 500 10773 ms - 1320
[HTTP]

共收到 1 条回复 时间 点赞

[W3C] Encountered internal error running command: Error: Cannot start the 'tv.danmaku.bili' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name '.ui.splash.SplashActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

找不到 activity,用 weditor 看看这个 activity 啥回事

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册