calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

Could not install DeviceAgent-Runner.app #1357

Closed kariasbolster closed 6 years ago

kariasbolster commented 6 years ago

MacOs Version: 10.13.1 IphoneSE iOs Version: 10.3.3

These are the commands I ran

export BUNDLE_ID=com.bnpp.wm.ebkgspios.private.sin.sit
export DEVICE_TARGET=61ebbddf27b94ea0a6659c05f0a3152fd66a9eec
export DEVICE_ENDPOINT=http://192.168.2.212:37265
ideviceinstaller -i app/sprint-18-01978093-asia-sit.ipa -u 61ebbddf27b94ea0a6659c05f0a3152fd66a9eec
DEBUG=1 bundle exec calabash-ios console
WARNING: could not locate iTunesMetadata.plist in archive!
WARNING: could not locate Payload/iWealth.app/SC_Info/iWealth.sinf in archive!
Copying 'app/sprint-18-01978093-asia-sit.ipa' to device... DONE.
Installing 'com.bnpp.wm.ebkgspios.private.sin.sit'
 - CreatingStagingDirectory (5%)
 - ExtractingPackage (15%)
 - InspectingPackage (20%)
 - TakingInstallLock (20%)
 - PreflightingApplication (30%)
 - InstallingEmbeddedProfile (30%)
 - VerifyingApplication (40%)
 - CreatingContainer (50%)
 - InstallingApplication (60%)
 - PostflightingApplication (70%)
 - SandboxingApplication (80%)
 - GeneratingApplicationMap (90%)
[1]    717 segmentation fault  ideviceinstaller -i app/sprint-18-01978093-asia-sit.ipa -u
Running irb...

#########################  Useful Methods  ##########################
     ids => List all the visible accessibility ids.
  labels => List all the visible accessibility labels.
    text => List all the visible texts.
   marks => List all the visible marks.
    tree => The app's visible view hierarchy.
   flash => flash(<query>); Disco effect for views matching <query>
 verbose => Turn debug logging on.
   quiet => Turn debug logging off.
    copy => Copy console commands to clipboard.
   clear => Clear the console.

Calabash says, "Console. Engaged."
calabash-ios 0.20.4> start_test_server_in_background
SHELL: xcrun simctl list devices --json
SHELL: xcrun instruments -s devices
DEBUG: HTTP: get http://192.168.2.212:27753/1.0/health {:retries=>1, :timeout=>0.5}
DEBUG: HTTP: get http://192.168.2.212:27753/1.0/health {:retries=>1, :timeout=>0.5}
DEBUG: Waiting for DeviceAgent to launch...
SHELL: /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/bin/iOSDeviceManager install /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app --device-id 61ebbddf27b94ea0a6659c05f0a3152fd66a9eec
RuntimeError:

Could not install /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app.  iOSDeviceManager says:

Checking for profile and app entitlement discrepancy
Error installing application: Error Domain=com.facebook.FBDeviceControl Code=0 "Failed to install application with path /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app" UserInfo={NSLocalizedDescription=Failed to install application with path /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app, NSUnderlyingError=0x7fb8421691e0 {Error Domain=com.facebook.FBDeviceControl Code=0 "Failed to install application" UserInfo={NSLocalizedDescription=Failed to install application}}}

    install <app-path>
        -d,--device-id  <device-identifier> iOS Simulator GUID or 40-digit physical device ID
        -u,--update-app <should-update-app> [OPTIONAL]  When true, will reinstall the app if the device contains an older version than the bundle specified DEFAULT=1
        -p,--profile-path   <profile-path> [OPTIONAL]   Path to provisioning profile
        -c,--codesign-identity  <codesign-identifier> [OPTIONAL]    Identity used to codesign app bundle [device only]. Deprecated - should use profile path.   DEFAULT=
        -i,--resources-path <resources-path> [OPTIONAL]     Path to resources (executables) to inject into app directory. A list of colon separated files may be specified.

    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ios_device_manager.rb:149:in `launch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:1378:in `launch_cbx_runner'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:292:in `launch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:167:in `run'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop.rb:113:in `run'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:408:in `block in new_run_loop'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:406:in `times'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:406:in `new_run_loop'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:365:in `relaunch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/core.rb:1567:in `start_test_server_in_background'
    from (irb):1
    from /Users/viseokent/.rubies/ruby-2.3.5/bin/irb:11:in `<main>'
calabash-ios 0.20.4>

And then I tried running the same commands in iPhone 7 and I got a different set of error.

iPhone 7 iOS Version: 10.3.3

export BUNDLE_ID=com.bnpp.wm.ebkgspios.private.sin.sit                                                                                                              ✔  1627  12:17:02
export DEVICE_TARGET=165c9664ca547378051ded382112a814b6759046
export DEVICE_ENDPOINT=http://192.168.2.196:37265
ideviceinstaller -i app/sprint-18-01978093-asia-sit.ipa -u 165c9664ca547378051ded382112a814b6759046
DEBUG=1 bundle exec calabash-ios console

WARNING: could not locate iTunesMetadata.plist in archive!
WARNING: could not locate Payload/iWealth.app/SC_Info/iWealth.sinf in archive!
Copying 'app/sprint-18-01978093-asia-sit.ipa' to device... DONE.
Installing 'com.bnpp.wm.ebkgspios.private.sin.sit'
 - CreatingStagingDirectory (5%)
 - ExtractingPackage (15%)
 - InspectingPackage (20%)
 - TakingInstallLock (20%)
 - PreflightingApplication (30%)
 - InstallingEmbeddedProfile (30%)
 - VerifyingApplication (40%)
 - CreatingContainer (50%)
 - InstallingApplication (60%)
 - PostflightingApplication (70%)
 - SandboxingApplication (80%)
 - GeneratingApplicationMap (90%)
[1]    1740 segmentation fault  ideviceinstaller -i app/sprint-18-01978093-asia-sit.ipa -u
Running irb...

#########################  Useful Methods  ##########################
     ids => List all the visible accessibility ids.
  labels => List all the visible accessibility labels.
    text => List all the visible texts.
   marks => List all the visible marks.
    tree => The app's visible view hierarchy.
   flash => flash(<query>); Disco effect for views matching <query>
 verbose => Turn debug logging on.
   quiet => Turn debug logging off.
    copy => Copy console commands to clipboard.
   clear => Clear the console.

Calabash says, "Ready to rumble."
calabash-ios 0.20.4> start_test_server_in_background
SHELL: xcrun simctl list devices --json
SHELL: xcrun instruments -s devices
DEBUG: HTTP: get http://192.168.2.196:27753/1.0/health {:retries=>1, :timeout=>0.5}
DEBUG: HTTP: get http://192.168.2.196:27753/1.0/health {:retries=>1, :timeout=>0.5}
DEBUG: Waiting for DeviceAgent to launch...
SHELL: /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/bin/iOSDeviceManager install /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app --device-id 165c9664ca547378051ded382112a814b6759046
RunLoop::Shell::Error:
There was an error executing:

/Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/bin/iOSDeviceManager install /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app --device-id 165c9664ca547378051ded382112a814b6759046

The command generated this output:

2017-11-29 12:17:27.288 iOSDeviceManager[1753:26140] *** Terminating app due to uncaught exception 'CBXException', reason: 'Unable to find appropriate codesign identity for device 165c9664ca547378051ded382112a814b6759046 / app com.apple.test.DeviceAgent-Runner combo'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff5764f2fb __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fff7dfbcc76 objc_exception_throw + 48
    2   iOSDeviceManager                    0x0000000100b090c6 +[Command resourcesFromArgs:] + 0
    3   iOSDeviceManager                    0x0000000100b15562 +[MobileProfile bestMatchProfileForApplication:device:] + 284
    4   iOSDeviceManager                    0x0000000100ae75e9 -[PhysicalDevice installApp:mobileProfile:codesignIdentity:resourcesToInject:shouldUpdate:] + 551
    5   iOSDeviceManager                    0x0000000100ae79d6 -[PhysicalDevice installApp:resourcesToInject:shouldUpdate:] + 67
    6   iOSDeviceManager                    0x0000000100aea228 +[InstallAppCommand execute:] + 876
    7   iOSDeviceManager                    0x0000000100b0bc99 +[CLI process:] + 1063
    8   iOSDeviceManager                    0x0000000100ad7431 main + 121
    9   libdyld.dylib                       0x00007fff7ebab145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/shell.rb:113:in `run_shell_command'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/ios_device_manager.rb:146:in `launch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:1378:in `launch_cbx_runner'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:292:in `launch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop/device_agent/client.rb:167:in `run'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/run_loop-2.6.2/lib/run_loop.rb:113:in `run'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:408:in `block in new_run_loop'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:406:in `times'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:406:in `new_run_loop'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/launcher.rb:365:in `relaunch'
    from /Users/viseokent/.gem/ruby/2.3.5/gems/calabash-cucumber-0.20.4/lib/calabash-cucumber/core.rb:1567:in `start_test_server_in_background'
    from (irb):1
    from /Users/viseokent/.rubies/ruby-2.3.5/bin/irb:11:in `<main>'
calabash-ios 0.20.4>

Nothing makes sense to me at all. Can you help with this?

jmoody commented 6 years ago

[1] 1740 segmentation fault ideviceinstaller -i app/sprint-18-01978093-asia-sit.ipa -u

ideviceinstaller failed.

'CBXException', reason: 'Unable to find appropriate codesign identity for device 165c9664ca547378051ded382112a814b6759046 / app com.apple.test.DeviceAgent-Runner combo'

As the error says, there is no codesign identity available to sign the DeviceAgent app for your device.

dben32 commented 6 years ago

sorry i am not sure if this is the right thread to post this, But i seem to be having an issue with codesigning too

Timed out after 120.05 seconds executing

 /Users/dben/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.3/lib/run_loop/device_agent/bin/iOSDeviceManager install /Users/dben/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.3/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app --device-id 3749aff8df3d3f63a9ef20342503e54eea84c227 --codesign-identity iPhone Developer: dben Enfield (AxxxxxxxV)

with a timeout of 120 (RunLoop::Shell::TimeoutError) ./features/support/ios/01_launch.rb:27:in `Before'

Device OS = 11.2.1 Mac OS = 10.13.2 Xcode = 9.1

In my case, it seems the correct identity is being supplied but times out. I have tried several times, even tried using a different device and I still get the same error. any idea on what to do will be greatly appreciated

jmoody commented 6 years ago

Try running without setting the code signing identity.

Tail the log:

$ tail -F ~/.calabash/iOSDeviceManager/logs/current.log

Make sure the device appears in Xcode as "available" in the Devices + Simulators window (Shift + Command + 2).

dben32 commented 6 years ago

I am not sure if this is what you are expecting

dben-Mac-mini:svn-2110 dben$ tail -F ~/.calabash/iOSDeviceManager/logs/current.log
2017-12-15 13:34:29.698 DEBUG FBControlCoreLogger:279 | IDESourceEditor: Successfully loaded
2017-12-15 13:34:29.698 DEBUG FBControlCoreLogger:279 | DFRSupportKit: Loading from /Applications/Xcode.app/Contents/Frameworks/DFRSupportKit.framework 
2017-12-15 13:34:29.699 DEBUG FBControlCoreLogger:279 | DFRSupportKit: Successfully loaded
2017-12-15 13:34:29.699 DEBUG FBControlCoreLogger:279 | DVTKit: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework 
2017-12-15 13:34:29.700 DEBUG FBControlCoreLogger:279 | DVTKit: Successfully loaded
2017-12-15 13:34:29.700 DEBUG FBControlCoreLogger:279 | DebugHierarchyFoundation: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DebugHierarchyFoundation.framework 
2017-12-15 13:34:29.702 DEBUG FBControlCoreLogger:279 | DebugHierarchyFoundation: Successfully loaded
2017-12-15 13:34:29.702 DEBUG FBControlCoreLogger:279 | DebugHierarchyKit: Loading from /Applications/Xcode.app/Contents/SharedFrameworks/DebugHierarchyKit.framework 
2017-12-15 13:34:29.704 DEBUG FBControlCoreLogger:279 | DebugHierarchyKit: Successfully loaded
2017-12-15 13:34:29.705 DEBUG FBControlCoreLogger:279 | Loaded All Private Frameworks [DTXConnectionServices, IDEFoundation, IDEiOSSupportCore, IBAutolayoutFoundation, IDEKit, IDESourceEditor, DFRSupportKit, DVTKit, DebugHierarchyFoundation, DebugHierarchyKit]
^X^C
dben32 commented 6 years ago

I got this on the terminal


2017-12-15 13:34:57.772 iOSDeviceManager[5601:691363]  iPhoneConnect: ## Unable to mount developer disk image, (Error Domain=com.apple.dtdevicekit Code=601 "Could not locate device support files." UserInfo={DeviceType=iPhone6,2, NSLocalizedDescription=Could not locate device support files., NSLocalizedRecoverySuggestion=This iPhone 5s (Model A1457, A1518, A1528, A1530) is running iOS 11.2.1 (15C153), which may not be supported by this version of Xcode.}) {
    DeviceType = "iPhone6,2";
    NSLocalizedDescription = "Could not locate device support files.";
    NSLocalizedRecoverySuggestion = "This iPhone 5s (Model A1457, A1518, A1528, A1530) is running iOS 11.2.1 (15C153), which may not be supported by this version of Xcode.";
}
jmoody commented 6 years ago

iPhoneConnect: ## Unable to mount developer disk image iPhone 5s is running iOS 11.2.1 (15C153), which may not be supported by this version of Xcode.})

Is this the device you are trying to connect to?

If so, the error message tells you exactly what is wrong - the device has an iOS version greater than the version that your current Xcode can support.

In order to target iOS 11.2, your active Xcode must be at least 9.2.

$ xcrun xcodebuild -version
dben32 commented 6 years ago

Thanks @jmoody I have now updated my xcod to 9.2 Updated Mac OS to HighSiera 10.13.2 (17C88)​ and Run_loop 2.6.3

Then I restarted the system and re-run my test

Thank you

tarunmittal2012 commented 3 years ago

@jmoody

I am getting error failed to install device agent exit code 5.

Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Failed to install DeviceAgent ExitCode: 5 Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., Error installing application: Failed to install application with path /var/folders/dd/ymbnyhwx4cd5fs2mr63vssmr0000gp/T/xdb/DeviceAgent.iOS.Dependencies/14b8db96af88a1b519aed9c325d95624/ipa/DeviceAgent-Runner.app

Below are iPad details.

Model Name - iPad (5th gen) Software Version - 14.0.1 Model Number - MP2F2LL/A

Nuget Package Details.

Xamarin ui test(3.0.12) NUnit3TestAdapter(3.17.0) NUnit(3.12.0)

Xcode ver 12.1

Below are mac configuration details.

=== Operating System ===

Mac OS X 10.15.6 Darwin 19.6.0 Darwin Kernel Version 19.6.0 Sun Jul 5 00:43:10 PDT 2020 root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64

=== Xamarin.iOS ===

Version: 14.2.0.12 (Visual Studio Community) Hash: e0ce49680 Branch: xcode12.1 Build date: 2020-10-20 09:52:06-0400

=== Apple Developer Tools ===

Xcode 12.1 (17222) Build 12A7403

=== Visual Studio Community 2019 for Mac ===

Version 8.7.9 (build 9) Installation UUID: 2280762c-b293-458e-a352-5a8d1bbe2af0 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

=== Mono Framework MDK ===

Runtime: Mono 6.12.0.93 (2020-02/620cf538206) (64-bit) Package version: 612000093