google/EarlGrey

Got "Image Not Found" while running the test

mrjimoy opened this issue · 2 comments

I am trying to add UI Tests to my project using EarlGrey 2.0 by following this steps to install the framework : https://www.youtube.com/watch?v=KQaA11qVQn0 (using Cocoapods). It build successfully but when I tried to run the test, I got this error:

2020-11-27 14:18:16.076586+0700 X-UITests-Runner[75526:5465621] The bundle X-UITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2020-11-27 14:18:16.076704+0700 X-UITests-Runner[75526:5465621] (dlopen_preflight(/X-blqsydhdzeecqndvwzwsshajcwdm/Build/Products/Debug-iphonesimulator/X-UITests-Runner.app/PlugIns/X-UITests.xctest/X-UITests): Library not loaded: @rpath/Alamofire.framework/Alamofire
  Referenced from: /X-blqsydhdzeecqndvwzwsshajcwdm/Build/Products/Debug-iphonesimulator/X-UITests-Runner.app/PlugIns/X-UITests.xctest/X-UITests
  Reason: image not found)

I have this on my podfile:

use_frameworks!

def shared_pods
  pod 'Alamofire'
  pod 'Firebase'
  pod 'Firebase/Analytics'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/Messaging'
  pod 'Firebase/Auth'
  pod 'Firebase/Database'
  pod 'Introspect'
  pod 'ReachabilitySwift'
  pod 'RealmSwift'
  pod 'SDWebImageSwiftUI'
  pod 'SwiftKeychainWrapper'
  pod 'Zip'
end

target 'X' do
  shared_pods
  pod 'EarlGreyApp'
end

target 'X-UITests' do
  inherit! :search_paths
  pod 'EarlGreyTest'
  pod 'eDistantObject', '0.9.0'
end

I have tried to uncheck the Find Implicit Dependencies on the scheme, but still got the error. Any help? Thanks.

You might have to remove use_frameworks! from the CocoaPods as EarlGreyTest is not a framework but a static lib. Can you move it to inside each target and let the test not have it?

This is the same issue as #1510