Appium (Android):应用程序未使用调试证书签名
Posted
技术标签:
【中文标题】Appium (Android):应用程序未使用调试证书签名【英文标题】:Appium (Android): App not signed with debug cert 【发布时间】:2017-03-15 17:17:45 【问题描述】:我正在使用以下配置在竹子上运行我的自动化脚本,并在模拟器上重新签署应用程序文件时遇到问题。我已经尽我所能,但不能说是什么问题,是 appium 问题,还是竹子问题或模拟器问题?
在此问题之前,我遇到了与以下链接相同的问题。我试图解决这个问题并开始面对这个问题。我也在 Appium 讨论中提出了这个问题。
这里是链接:https://discuss.appium.io/t/uiautomator2-error-cannot-read-property-isscreenlocked-of-undefined/15153
-
Appium: appium@1.6.4-beta 也试过 appium@1.6.3
jdk: 1.8.0_102
平台版本: '7.1'
automationName: 'uiautomator2'
平台名称: 'android'
日志:
[Appium] Welcome to Appium v1.6.3
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session "desiredCapabilities":"app":"apk-path","newCommandTimeout":"600","platformVersion":"7.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554"
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: ["app":"apk-path","newCommandTimeout":"600","platformVersion":"7.1","automationName":"uiautomator2","platformName":"Android","deviceName":"emulator-5554",null,null,null,null]
[Appium] Creating new AndroidUiautomator2Driver session
[Appium] Capabilities:
[Appium] app: 'apk-path'
[Appium] newCommandTimeout: '600'
[Appium] platformVersion: '7.1'
[Appium] automationName: 'uiautomator2'
[Appium] platformName: 'Android'
[Appium] deviceName: 'emulator-5554'
[BaseDriver] Capability 'newCommandTimeout' changed from string ('600') to integer (600). This may cause unexpected behavior
[BaseDriver] Session created with session id: 25e878b1-f9cf-4fb5-9070-d88617c91374
[BaseDriver] Using local app 'apk-path'
[debug] [UiAutomator2] Checking whether app is actually present
[UiAutomator2] UIAutomator2 Driver version:0.2.3
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_102
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/admin/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1'
[debug] [ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/admin/Library/Android/sdk/platform-tools/adb
[debug] [ADB] Setting device id to emulator-5554
[debug] [AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/admin/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[debug] [ADB] badging package: package
[debug] [ADB] badging act: Activity
[debug] [AndroidDriver] Parsed package and activity are: package/Activity
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[debug] [ADB] Attempting to kill all io.appium.uiautomator2.server processes
[debug] [ADB] Getting all processes with io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","ps"]
[ADB] No io.appium.uiautomator2.server process found to kill, continuing...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk"]
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk"]
[debug] [ADB] Application '/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk' already installed. Continuing.
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[debug] [ADB] Application '/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to 8200
[debug] [ADB] Forwarding system: 8200 to device: 6790
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","forward","tcp:8200","tcp:6790"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","window"]
[AndroidDriver] Screen already unlocked, doing nothing
[debug] [AndroidDriver] Extracting strings from apk apk-path null /var/folders/w3/85v473ln4n795wf2dd39mgjw0000gn/T/package
[debug] [ADB] Extracting strings for language: default
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[debug] [ADB] Device API level: 25
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","persist.sys.locale"]
[debug] [ADB] Current device property 'persist.sys.locale':
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.locale"]
[debug] [ADB] Current device property 'ro.product.locale': en-US
[debug] [ADB] No strings.xml for language 'en', getting default strings.xml
[debug] [ADB] Reading strings from converted strings.json
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","push","/var/folders/w3/85v473ln4n795wf2dd39mgjw0000gn/T/package/strings.json","/data/local/tmp"]
[debug] [ADB] Checking app cert for apk-path.
[debug] [ADB] App not signed with debug cert.
[debug] [ADB] Resigning apk.
[ADB] Error: Could not sign with default ceritficate. Original error Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java -jar /usr/local/lib/node_modules/appium/node_modules/appium-adb/jars/sign.jar apk-path --override' exited with code 1
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at ADB.callee$0$0$ (../../../lib/tools/apk-signing.js:21:9)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as throw
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:108:47)
at /usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:119:28
at flush (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
at combinedTickCallback (internal/process/nexttick.js:67:7)
at process.tickCallback (internal/process/nexttick.js:98:9)
[Error: Could not sign with default ceritficate. Original error Command '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java -jar /usr/local/lib/node_modules/appium/node_modules/appium-adb/jars/sign.jar apk-path --override' exited with code 1]
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [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
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/admin/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","package"]
有人可以帮我解决这个问题吗?
谢谢
【问题讨论】:
【参考方案1】:我遇到了同样的问题。我被告知要重置三星 Galaxy S8 的出厂设置!那没有用。我读过这是网络超时,所以增加网络超时。我看到你添加了 newCommandTimeout: '600' 我做了同样的事情,但没有奏效。
您是否运行过旧版本的 Appium?我尝试使用 Windows U/I 1.4.16 版!然后我尝试了 Windows U/I 的 beta 版本。我终于删除了 U/I 版本并安装了命令行版本 1.6.5。我仍然遇到同样的问题。
【讨论】:
【参考方案2】:在运行脚本时,我使用命令行运行但没有提供自动化名称“uiautomator2”,并且脚本开始为我工作。直到现在我真的不明白问题到底出在哪里,因为它工作正常,我没有再专注于这个问题。 希望这对您有所帮助。
谢谢
【讨论】:
以上是关于Appium (Android):应用程序未使用调试证书签名的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Appium 滚动 Robot Framework 以在 Android 设备上测试应用程序
未检测到@content-desc - Android 测试
使用 Appium 脚本自动化 android 模拟器和浏览器