AppCrawler远程连接手机报错:Original error: 'Command '/usr/local/Android/sdk/platform-tools/adb -P 5037 -s 192.168.31.103\:7401 shell getprop ro.build.version.sdk' exited with code 1'; Command output: adb: device unauthorized.

Success控制台输出
Started by upstream project "多台安卓同时执行自动化测试" build number 35
originally caused by:
 Started by user root
Running as SYSTEM
Building remotely on demo in workspace /tmp/jenkins/workspace/多台安卓同时执行自动化测试/devices/P7CDU18929008778/label/demo
[demo] $ /bin/bash /tmp/jenkins7839031159034032167.sh
\
20211121122041_com.bs.finance
20211121122142_com.bs.finance
20211121122704_com.bs.finance
20211121123119_com.bs.finance
20211121123433_com.bs.finance
20211121123525_com.bs.finance
20211121130518_com.bs.finance
20211121130543_com.bs.finance
20211121144237_com.bs.finance
20211121144558_com.bs.finance
20211121155556_com.bs.finance
20211121165019_com.bs.finance
20211121165236_com.bs.finance
20211121165528_com.bs.finance
20211121171739_com.bs.finance
20211121173548_com.bs.finance
20211121174138_com.bs.finance
20211121183657_com.bs.finance
20211121183740_com.bs.finance
20211121183930_com.bs.finance
20211121184115_com.bs.finance
20211121193950_com.bs.finance
appcrawler-2.7.1-hogwarts.jar
demo.yaml
stf.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    88  100    58  100    30    781    403 --:--:-- --:--:-- --:--:--   794
Device P7CDU18929008778 added successfully
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   102  100   102    0     0   2812      0 --:--:-- --:--:-- --:--:--  2914
failed to authenticate to 192.168.31.103:7401
Device P7CDU18929008778 remote connected successfully
List of devices attached
192.168.31.103:7401	unauthorized

remote_device=192.168.31.103:7401
2021-11-21 21:29:32 INFO [AppCrawler$.76.main] 
-------------------------------------------------
appcrawler v2.7.0 全平台自动遍历测试工具
Q&A: https://ceshiren.com/c/opensource/appcrawler
author: 思寒 seveniruby@霍格沃兹测试开发学社
-------------------------------------------------

2021-11-21 21:29:32 INFO [AppCrawler$.189.parseParams] Find Conf /root/AppCrawler/demo.yaml
2021-11-21 21:29:33 INFO [AppCrawler$.218.parseParams] use appium in the config file http://127.0.0.1:4723/wd/hub
2021-11-21 21:29:34 INFO [AppCrawler$.330.addLogFile] 
-------------------------------------------------
appcrawler v2.7.0 全平台自动遍历测试工具
Q&A: https://ceshiren.com/c/opensource/appcrawler
author: 思寒 seveniruby@霍格沃兹测试开发学社
-------------------------------------------------

2021-11-21 21:29:34 INFO [AppCrawler$.333.addLogFile] result directory = 20211121212931_com.bs.finance
2021-11-21 21:29:34 INFO [Crawler.127.start] set xpath attribute with List(name(), name, label, value, resource-id, content-desc, text, id, name, innerText, tag, class)
2021-11-21 21:29:34 INFO [Crawler.131.start] set tag attribute with List(name(), name, label, resource-id, content-desc, id, name, tag, class)
2021-11-21 21:29:34 INFO [Crawler.101.$anonfun$loadPlugins$4] com.ceshiren.appcrawler.plugin.TagLimitPlugin@73511076
2021-11-21 21:29:34 INFO [Crawler.101.$anonfun$loadPlugins$4] com.ceshiren.appcrawler.plugin.ReportPlugin@7927bd9f
2021-11-21 21:29:34 INFO [Crawler.101.$anonfun$loadPlugins$4] com.ceshiren.appcrawler.plugin.FreeMind@532721fd
2021-11-21 21:29:34 INFO [Plugin.23.init] com.ceshiren.appcrawler.plugin.TagLimitPlugin init
2021-11-21 21:29:34 INFO [Plugin.23.init] com.ceshiren.appcrawler.plugin.ReportPlugin init
2021-11-21 21:29:34 INFO [Plugin.23.init] com.ceshiren.appcrawler.plugin.FreeMind init
2021-11-21 21:29:34 INFO [ReportFactory$.33.initReportPath] reportPath=/root/AppCrawler/20211121212931_com.bs.finance
2021-11-21 21:29:34 INFO [ReportFactory$.35.initReportPath] testcaseDir=/root/AppCrawler/20211121212931_com.bs.finance/tmp/
2021-11-21 21:29:34 INFO [ReportFactory$.38.initReportPath] create /root/AppCrawler/20211121212931_com.bs.finance/tmp directory
2021-11-21 21:29:34 INFO [Crawler.138.start] prepare setup Appium
2021-11-21 21:29:34 INFO [Crawler.293.setupAppium] afterAllMax=2
2021-11-21 21:29:37 INFO [Crawler.299.setupAppium] 
2021-11-21 21:29:37 INFO [Crawler.335.setupAppium] use AppiumClient
2021-11-21 21:29:37 INFO [Crawler.336.setupAppium] HashMap(appActivity -> .ui.common.WelcomeFinalActivity, appium -> http://127.0.0.1:4723/wd/hub, noReset -> true, appPackage -> com.bs.finance, fullReset -> false)
2021-11-21 21:29:38 INFO [AppiumClient.46.<init>] Capabilities {app: , appActivity: .ui.common.WelcomeFinalActi..., appPackage: com.bs.finance, appium: http://127.0.0.1:4723/wd/hub, deviceName: demo, fullReset: false, newCommandTimeout: 120, noReset: true}
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: 'Command '/usr/local/Android/sdk/platform-tools/adb -P 5037 -s 192.168.31.103\:7401 shell getprop ro.build.version.sdk' exited with code 1'; Command output: adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', java.version: '1.8.0_231'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: 'Command '/usr/local/Android/sdk/platform-tools/adb -P 5037 -s 192.168.31.103\:7401 shell getprop ro.build.version.sdk' exited with code 1'; Command output: adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

    at getResponseForW3CError (/usr/local/node-v16.13.0-linux-x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
    at asyncHandler (/usr/local/node-v16.13.0-linux-x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', java.version: '1.8.0_231'
Driver info: driver.version: AndroidDriver
	at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:216)
	at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:225)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
	at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:363)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)
	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:99)
	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:97)
	at com.ceshiren.appcrawler.driver.AppiumClient.<init>(AppiumClient.scala:52)
	at com.ceshiren.appcrawler.core.Crawler.setupAppium(Crawler.scala:339)
	at com.ceshiren.appcrawler.core.Crawler.start(Crawler.scala:139)
	at com.ceshiren.appcrawler.AppCrawler$.startCrawl(AppCrawler.scala:323)
	at com.ceshiren.appcrawler.AppCrawler$.parseParams(AppCrawler.scala:290)
	at com.ceshiren.appcrawler.AppCrawler$.main(AppCrawler.scala:81)
	at com.ceshiren.appcrawler.AppCrawler.main(AppCrawler.scala)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:193)
	... 20 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: 'Command '/usr/local/Android/sdk/platform-tools/adb -P 5037 -s 192.168.31.103\:7401 shell getprop ro.build.version.sdk' exited with code 1'; Command output: adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'localhost.localdomain', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', java.version: '1.8.0_231'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error getting device API level. Original error: Error executing adbExec. Original error: 'Command '/usr/local/Android/sdk/platform-tools/adb -P 5037 -s 192.168.31.103\:7401 shell getprop ro.build.version.sdk' exited with code 1'; Command output: adb: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

    at getResponseForW3CError (/usr/local/node-v16.13.0-linux-x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
    at asyncHandler (/usr/local/node-v16.13.0-linux-x64/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
	at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
	... 25 more
disconnected everything
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    60  100    60    0     0   2215      0 --:--:-- --:--:-- --:--:--  2307
Device P7CDU18929008778 removed successfully
Finished: SUCCESS

adb devices 看下设备状态是否正确,从报错来看,是设备链接状态不对,看下手机上的授权弹窗,是否有手动确认

关闭