新手区 [已解决] Mac 系统,用 appium.app 会出错,在命令行运行 appium&一切正常

大卫 · 2015年11月15日 · 最后由 大卫 回复于 2015年11月27日 · 79 次阅读

Mac 系统上,新安装的 ruby+appium.app+Simulator 一直有问题连不通,simulator 也不能自动启动起来。后来发现这个问题只在 appium.app 上才会有,在命令行启动 appium,一切都是正常的...想了很久也不知道哪里出了问题。安装的时候是先装的 node->npm install appium, 然后才装的 appium 应用程序。

Launch Appium.app 后,在浏览器里访问http://0.0.0.0:4723/是可以得到正常字符串的。求大家指导一个解决思路...

已经解决,错误原因
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:

这个链接上有给出思路:https://github.com/appium/appium/issues/5720

解决方案
Currently Instruments-Without-Delay does not work with iOS 9+. We are working on a fix for this.
In order to run the server without this shim, in "Developer Settings" add a "Custom Server Flag" --native-instruments-lib before launching the server.

Xcode:7.1.1
OS X: 10.10.5
Appium.app: 1.4.13.dmg
iOS Simulator: 9.1

info: [debug] Using local app from desired caps: /Users/davidctrip/Desktop/sample-code-master/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app
info: [debug] Creating new appium session 832d452e-7401-45ff-89c3-694763816037
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version

info: [debug] Xcode version set to 7.1.1

info: [debug] Setting iOS SDK Version

info: [debug] iOS SDK Version set to 9.1
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"7.1.1","iOSSDKVersion":"9.1","deviceName":"iPhone Simulator","platformVersion":"9.1"}

info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: "iPhone Simulator (9.1)" to: "iPhone 6 (9.1) ["
info: [debug] Final device string is: 'iPhone 6 (9.1) ['
info: [debug] iOS sim UDID is 21FD4119-A984-4767-A0C9-6BEEB8102F88

info: [debug] Auto-detecting iOS udid...
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Parsed app Localizable.strings
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/davidctrip/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"oneByOne"}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
...
info: [debug] Dynamic bootstrap path: /Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js
info: [debug] Reusing dynamic bootstrap: /Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"7.1.1","iOSSDKVersion":"9.1","deviceName":"iPhone Simulator","platformVersion":"9.1"}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: "iPhone Simulator (9.1)" to: "iPhone 6 (9.1) ["
info: [debug] Final device string is: 'iPhone 6 (9.1) ['

info: [debug] We're on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"7.1.1","iOSSDKVersion":"9.1","deviceName":"iPhone Simulator","platformVersion":"9.1"}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: "iPhone Simulator (9.1)" to: "iPhone 6 (9.1) ["
info: [debug] Final device string is: 'iPhone 6 (9.1) ['
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons

info: [debug] Killall iOS Simulator

info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase 21FD4119-A984-4767-A0C9-6BEEB8102F88 and timeout: 2000

info: [debug] Cleaning app data files

warn: Applications directory /Users/davidctrip/Library/Developer/CoreSimulator/Devices/21FD4119-A984-4767-A0C9-6BEEB8102F88/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
warn: Applications directory /Users/davidctrip/Library/Developer/CoreSimulator/Devices/21FD4119-A984-4767-A0C9-6BEEB8102F88/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed

info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture

info: [debug] Not pre-launching simulator

info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments

info: [debug] Attempting to run app on iPhone 6 (9.1) [
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/davidctrip/Desktop/sample-code-master/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app -e UIASCRIPT "/Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}

info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x108A1B000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] [INSTSERVER] Instruments exited with code null

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6 (9.1) [

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/davidctrip/Desktop/sample-code-master/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app -e UIASCRIPT "/Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mm
info: [debug] [INST STDERR] ap() error 1 at address=0x10EE6C000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6 (9.1) [
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/davidctrip/Desktop/sample-code-master/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app -e UIASCRIPT "/Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments

info: [debug] [INSTSERVER] Instruments exited with code null

info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 6 (9.1) [

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/davidctrip/Desktop/sample-code-master/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app -e UIASCRIPT "/Users/davidctrip/Library/Application Support/appium/bootstrap/bootstrap-f062718992d59810.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x10B908000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Killall iOS Simulator
info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase 21FD4119-A984-4767-A0C9-6BEEB8102F88 and timeout: 2000

info: [debug] Cleaning app data files

warn: Applications directory /Users/davidctrip/Library/Developer/CoreSimulator/Devices/21FD4119-A984-4767-A0C9-6BEEB8102F88/data/Containers/Data/Application doesn't exist. Have you run this simulator before?
warn: Applications directory /Users/davidctrip/Library/Developer/CoreSimulator/Devices/21FD4119-A984-4767-A0C9-6BEEB8102F88/data/Containers/Bundle/Application doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:440:31)
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
info: <-- POST /wd/hub/session 500 16843.671 ms - 182

共收到 11 条回复 时间 点赞

你给的线索实在太少了。没法帮你。

appium-doctor 结果是啥

信息太少了,只能告诉你几个确定的点:

  1. appium 命令行和 appium.app 如果想同时运行要手动改端口,否则其中一个会因为端口被占用起不来。
  2. 如果你命令行和 appium.app 用的是同一个版本的 appium ,那么他们内置的 appium server 区别仅在于使用了不同的 node ,其他没什么区别。

要定位问题,log 是需要的,很多错误的现象长得都差不多。

#3 楼 @chenhengjie123
谢谢,按这个思路研究下...
刚发现了一个问题,在 Appium->General Settings->Maximum Log Length 这个 textbox 这里,值是 0,而且不是可修改状态的,或者我没找到能修改的办法...其他正常显示 log 的机器,这里显示的是 20000...
这个 Maximum Log Length 是跟哪里相关的....

#2 楼 @sanlengjingvv 就是正常的没有 Android Home 的错,因为不用 mac 测安卓所以没管它

#4 楼 @davidf 这个已经解决了,重新 reset 了一下配置文件就好了...

#1 楼 @lihuazhang 没有 log 的问题解决了,重新把 appium 的 log 贴了出来,如果有时间麻烦看一眼...

{"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] dyld: could not load inserted library '/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib' because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x10B908000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

这里出错了吧

#8 楼 @lihuazhang 真心感谢,一开始还纠结了半天,后来发现你已经发过贴指导过解决方案了...
现在都搞定了,叩谢

#9 楼 @davidf 你好 我遇到了跟你一样的问题,你最后是怎么解决的,我看了你提供思路的帖子没能解决我的问题

#10 楼 @diao2007 我的解决方案写在上面了的:
解决方案:
Currently Instruments-Without-Delay does not work with iOS 9+. We are working on a fix for this.
In order to run the server without this shim, in "Developer Settings" add a "Custom Server Flag" --native-instruments-lib before launching the server.

如果你按这个没能解决,可能要把错误贴出来才能分析

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