iosfirebaseautomated-testsfastlaneaws-device-farm

"Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation"


I am using fastlane plugin(aws_device_run_ios) to run the test in device farm in aws, but there some error appears when I run the fastlane command, its nothing to do with AWS, its related to firebase I think, I also using firebase in the project

I didnt find any solution can help me, this is the error I got

❌ /Users/admin/Desktop/MyIOSApp/Pods/FirebaseCore/Firebase/Core/FIRVersion.m:18:2: "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation"

error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation"

^

❌ /Users/admin/Desktop/MyIOSApp/Pods/FirebaseCore/Firebase/Core/FIRVersion.m:22:2: "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation"

error "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation"

^

this the podfile looks like:

# Pods for MyIOSApp
pod 'Alamofire', '~> 4.7'
pod 'RSFloatInputView'
pod 'SkyFloatingLabelTextField', '~> 3.0'
pod 'SwiftyJSON'
pod 'SwiftKeychainWrapper'
pod 'Firebase/Core'
pod 'Fabric', '~> 1.9.0'
pod 'Crashlytics', '~> 3.12.0'

target 'MyIOSAppTests' do
    inherit! :search_paths
    pod 'Firebase/Core'
    # Pods for testing
end

target 'MyIOSAppUITests' do
    inherit! :search_paths
    pod 'Firebase/Core'
    # Pods for testing
end

and this is my fastfile :

lane :aws_device_run_ios do
ENV['AWS_ACCESS_KEY_ID']     = '******'
ENV['AWS_SECRET_ACCESS_KEY'] = '******'
ENV['AWS_REGION']            = 'us-west-2'
#Build For Testing
xcodebuild(
scheme: 'MyIOSApp',
destination: 'generic/platform=iOS',
configuration: 'Release',
derivedDataPath: 'aws',
xcargs: "GCC_PREPROCESSOR_DEFINITIONS='AWS_UI_TEST' 
ENABLE_BITCODE=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build-for-testing"
)
# Transform .app into AWS compatible IPA
aws_device_farm_package(
derrived_data_path: "aws",
configuration: "Release"
 )
 # RUN tests on AWS Device Farm
aws_device_farm(
device_pool:      "DeviceIOS"
)
end

how to solve this error, in the error mentioned that to add -DFirebase_VERSION=... I did not know how and where to do that?! please help thanks in advance


Solution

  • It looks like the fastfile is overriding the GCC_PREPROCESSOR_DEFINITIONS options for building the FirebaseCore pod. "GCC_PREPROCESSOR_DEFINITIONS": "FIRCore_VERSION=5.4.1 Firebase_VERSION=5.20.0" from https://github.com/CocoaPods/Specs/blob/master/Specs/8/b/d/FirebaseCore/5.4.1/FirebaseCore.podspec.json#L42.

    I don't know much about fastlane, but xcargs is probably not the right place to add GCC_PREPROCESSOR_DEFINITIONS='AWS_UI_TEST'. It should be on a setting that is specific to building a unit test target, not a setting that affects all of the targets in the app.