OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 373 forks source link

Build failing: Could not get GOOGLE_APP_ID in Google Services file from build environment #1169

Closed kgj-chated closed 3 years ago

kgj-chated commented 3 years ago

I am trying to integrate this SDK into an iOS app. I am getting this build error: info: Exec FirebaseCrashlytics Run from Pods error: Could not get GOOGLE_APP_ID in Google Services file from build environment

I had faced these other issues too in the process of following docs from here: https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4---install-for-ios-using-cocoapods-for-ios-apps

Issue 1: openUrl is unavailable: not available on iOS (App Extension) Solved by following advice from here: https://github.com/facebook/react-native/issues/25792#issuecomment-517295859

Issue 2: "AccessibilityResources.bundle" not found Solved by following advice from here: https://github.com/facebook/react-native/issues/29709#issuecomment-696540223

Description: Directory structure inside iOS:

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# Segment requires minimum deployment target to be 11.0: https://github.com/segmentio/analytics-react-native/issues/245#issuecomment-741722434
platform :ios, '11.0'

target 'Verb' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  target 'VerbTests' do
    inherit! :complete
    # Pods for testing
  end

  # https://github.com/oblador/react-native-vector-icons#option-with-cocoapods
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  # https://github.com/react-native-svg/react-native-svg#cocoapods
  pod 'RNSVG', :path => '../node_modules/react-native-svg'

  # https://github.com/react-native-google-signin/google-signin/blob/master/docs/ios-guide.md#with-cocoapods
  pod 'GoogleSignIn', '~> 5.0.2'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'

  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'

  pod 'react-native-webview', :path => '../node_modules/react-native-webview'

  pod 'libbambuser-ios', '1.0.0'

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # ! FIX "'event2/event-config.h' file not found": https://github.com/facebook/react-native/issues/30836#issuecomment-772830882
  use_flipper!({ 'Flipper-Folly' => '2.3.0' })
  post_install do |installer|
    flipper_post_install(installer)
    ################### ADD THE FOLLOWING #########################
    installer.pods_project.targets.each do |target|
      if target.name == "React-Core.common-AccessibilityResources"
        target.remove_from_project
      end
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        # [FIX: Issue after adding OneSignal service extension](https://github.com/facebook/react-native/issues/25792#issuecomment-517295859)
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end
    ###############################################################
  end
end

target 'OneSignalNotificationServiceExtension' do
  # [FIX: "AccessibilityResources.bundle" not found](https://github.com/facebook/react-native/issues/29709#issuecomment-696540223)
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  pod 'OneSignal', '>= 3.0', '< 4.0'
end

target 'Verb-tvOS' do
  # Pods for Verb-tvOS

  target 'Verb-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

pod update terminates successfully with this log

[!] The `Verb [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Verb/Pods-Verb.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `Verb [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Verb/Pods-Verb.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `OneSignalNotificationServiceExtension [Debug]` target overrides the `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` build setting defined in `Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The `OneSignalNotificationServiceExtension [Release]` target overrides the `CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER` build setting defined in `Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig'. This can lead to problems with the CocoaPods installation
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.Build in debug mode fails with this error:

Environment

  1. What version of the OneSignal React-Native SDK are you using: ^4.0.3
  2. How did you add the SDK to your project: Yarn and Cocoapods

Steps I followed

  1. Install the OneSignal SDK using yarn into your project
  2. Follow all steps from here exactly (except the last step of adding 4.4 Add App Group): https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4---install-for-ios-using-cocoapods-for-ios-apps Note: Adding group asked for a new certificate which I don't want to do currently so as to keep things simple!

I am not familiar with iOS native development, but as far as I understand, I can see that the target OneSignalNotificationServiceExtension is also installing all the pods mentioned under the target Verb which doesn't feel right to me. Shouldn't OneSignalNotificationServiceExtension only care about `pod 'OneSignal', '>= 3.0', '< 4.0'?

If I should be adding some more info, kindly let me know!

rgomezp commented 3 years ago

Howdy, Thank you for your very detailed issue.

We just released a new version of the SDK. Can you upgrade and retry? If you are unsuccessful, we can dig deeper to see what your issue may be.

kgj-chated commented 3 years ago

Hi @rgomezp I have updated the react-native-onesignal package to ^4.0.4 after doing clean install of node packages and Pods. Still the same issue is there. Please have a look!

image
hugoh59 commented 3 years ago

Exactly same issue here, any fix!?

jkasten2 commented 3 years ago

The OneSignalNotificationServiceExtension is an independent target, it doesn't depend on React Native or any Google libraries.

I would expect your pod file to just have a single pod for OneSignal and nothing else to do this:

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 3.0', '< 4.0'
end

From the error it looks like Google Services is somehow automatically being added to the OneSignalNotificationServiceExtension when it should not.

If simply your Podfile to the above for the OneSignalNotificationServiceExtension entry does not work can you provide step-by-step instructions on how to reproduce the issue with a new project?

rgomezp commented 3 years ago

Closing due to no response.