Appium(Android):App未使用调试证书签名

时间:2017-03-15 17:17:45

标签: java android continuous-integration appium bamboo

我使用以下配置在Bamboo上运行自动化脚本,并在模拟器上重新签名应用程序文件时遇到问题。我已经尝试了但我不能说出问题是什么,是appium,还是竹子或模拟器问题?

之前的问题,我遇到了与以下链接相同的问题。我试图解决这个问题,并开始面对这个问题。我也在Appium讨论过这个问题。

以下是链接:https://discuss.appium.io/t/uiautomator2-error-cannot-read-property-isscreenlocked-of-undefined/15153

  1. Appium: appium@1.6.4-beta,并尝试使用appium@1.6.3
  2. jdk: 1.8.0_102
  3. platformVersion:'7.1'
  4. automationName:'uiautomator2'
  5. platformName:'Android'
  6. 日志:

    [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"]
    

    有人可以帮我吗?

    由于

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。有人告诉我重置三星Galaxy S8的出厂设置!那没用。我已经知道它是网络超时,因此会增加网络超时时间。我看到你添加了newCommandTimeout:' 600'我做了同样的事情但没有用。

您是否有旧版Appium正在运行?我试过Windows U / I版本1.4.16!然后我尝试了Windows U / I的测试版。我终于删除了U / I版本并安装了命令行版本1.6.5。我仍遇到同样的问题。

答案 1 :(得分:0)

在运行脚本时,我使用命令行运行而没有提供自动化名称“uiautomator2”,脚本开始为我工作。我真的不明白这个问题究竟到底在哪里,因为它工作正常我没有再集中精力解决这个问题。 希望这对你有所帮助。

由于