启动会话时无法使用默认证书签名的Appium台式机服务器错误

时间:2018-08-16 13:08:21

标签: appium appium-desktop

我无法在Appium桌面服务器上启动新会话。我没有找到适合我的修复程序。这是我的错误信息:

Encountered internal error running command: Error: Could not sign with 
default certificate. Original error Command ''C:\\Program 
Files\\Java\\jdk1.8.0_181\\bin\\java.exe' -jar 'C:\\Program Files 
(x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium- 
adb\\jars\\sign.jar' 'C:\\Program Files 
(x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium- 
uiautomator2-server\\apks\\appium-uiautomator2-server-v1.12.0.apk' -- 
override' exited with code 1

日志:

[Appium] Creating new AndroidUiautomator2Driver (v1.12.0) session
[Appium] Capabilities:
[Appium]   app: "myapp/path/"
[Appium]   appActivity: mydeviceActivity
[Appium]   appPackage: base.apk
[Appium]   automationName: UiAutomator2
[Appium]   deviceName: OPPO F1s
[Appium]   platformName: Android
[Appium]   platformVersion: 5.1
[Appium]   newCommandTimeout: 0
[Appium]   connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"app":"https://drive.googl...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: connectHardwareKeyboard.
[BaseDriver] Session created with session id: a231071d-b167-42f3-9c4c-ffecc32e9076
............
[BaseDriver] Skipping 'https://drive.google..........' caching, because the HEAD response didn't return any valid Last-Modified headers
[UiAutomator2] Checking whether app is actually present
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_181
[ADB] Checking whether adb is present
[ADB] Found 1 'build-tools' folders under 'C:\Program Files\Android\SDK' (newest first):
[ADB]     C:/Program Files/Android/SDK/build-tools/28.0.2
[ADB] Using adb.exe from C:\Program Files\Android\SDK\platform-tools\adb.exe
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '5.1'
[ADB] Setting device id to SOVW6PUS99999999
[ADB] Getting device platform........................................
[ADB] Running 'C:\Program Files\Android\SDK\platform-tools\adb.exe -P 5037 -s SOVW6PUS99999999 shell am force-stop io.appium.uiautomator2.server'
[ADB] Checking app cert for C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk
[ADB] Using apksigner.bat from C:\Program Files\Android\SDK\build-tools\28.0.2\apksigner.bat
[ADB] Starting 'C:\Program Files\Android\SDK\build-tools\28.0.2\apksigner.bat' with args 'verify,--print-certs,C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk'
[ADB] 'C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk' is not signed with debug cert.
[ADB] Zip-aligning 'C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk'
[ADB] Checking whether zipalign is present
[ADB] Using zipalign.exe from C:\Program Files\Android\SDK\build-tools\28.0.2\zipalign.exe
[ADB] Signing 'C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk' with default cert
[ADB] Starting 'C:\Program Files\Android\SDK\build-tools\28.0.2\apksigner.bat' with args 'sign,--key,C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-adb\keys\testkey.pk8,--cert,C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-adb\keys\testkey.x509.pem,C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk'
[ADB] Cannot use apksigner tool for signing. Defaulting to sign.jar. Original error: Command ''C:\\Program Files\\Android\\SDK\\build-tools\\28.0.2\\apksigner.bat' sign --key 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\keys\\testkey.pk8' --cert 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\keys\\testkey.x509.pem' 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v1.12.0.apk'' exited with code 1; StdErr: 'C:\Program' is not recognized as an internal or external command,
[ADB] operable program or batch file.
[ADB] 
[ADB] Resigning apk.
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
[ADB] Running 'C:\Program Files\Android\SDK\platform-tools\adb.exe -P 5037 -s SOVW6PUS99999999 shell am force-stop base.apk'
[ADB] Removing forwarded port socket connection: 8200 
[ADB] Running 'C:\Program Files\Android\SDK\platform-tools\adb.exe -P 5037 -s SOVW6PUS99999999 forward --remove tcp\:8200'
[ADB] Running 'C:\Program Files\Android\SDK\platform-tools\adb.exe -P 5037 -s SOVW6PUS99999999 forward --remove tcp\:8200'
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command ''C:\\Program Files\\Android\\SDK\\platform-tools\\adb.exe' -P 5037 -s SOVW6PUS99999999 forward --remove tcp\:8200' exited with code 1'; Stderr: 'error: listener 'tcp:8200' not found'; Code: '1''
[BaseDriver] Event 'newSessionStarted' logged at 1534424157559 (19:55:57 GMT+0700 (SE Asia Standard Time))
[MJSONWP] Encountered internal error running command: Error: Could not sign with default certificate. Original error Command ''C:\\Program Files\\Java\\jdk1.8.0_181\\bin\\java.exe' -jar 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\jars\\sign.jar' 'C:\\Program Files (x86)\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v1.12.0.apk' --override' exited with code 1

已编辑,已解决: 感谢Ross,我找到了问题所在。 我已经解决了此问题,方法是将ANDROID_HOME和JAVA_HOME的路径从C:\Program Files\更改为C:\PROGRA~1\,就像它所说的here一样。

1 个答案:

答案 0 :(得分:0)

通过正确设置desirableCapabilities可以解决此问题。通常,我们将automationName指定为uiautomator2。我们纠正错误的那一刻就抛出了。

确切想要的功能将是这样,“ automatorName”文本“ UiAutomator2” 还有另一个属性,用于跳过appium桌面中的签名过程。

“ noSign”“ true”

同时使用这两个所需的功能将可以正常工作。