invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

[πŸ›] GoogleMobileAds/GoogleMobileAds.h' file not found #4638

Closed a-c-sreedhar-reddy closed 3 years ago

a-c-sreedhar-reddy commented 3 years ago

Issue

Building the project with react-native-firebase/admob gives an error 'GoogleMobileAds/GoogleMobileAds.h' file not found. The error is in the file RNFBAdMob/RNFBAdMobModule.m

Project Files

   - iOS: `Podfile` contents 
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'DailyBreath' do

  config = use_native_modules!
  pod 'Google-Mobile-Ads-SDK'
  use_react_native!(:path => config["reactNativePath"])

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

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

  pod 'react-native-geolocation', :path => '../node_modules/@react-native-community/geolocation'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
  target 'DailyBreathTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

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

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

Javascript

Click To Expand

#### `package.json`: ```json { "name": "DailyBreath", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "debug": "react-devtools", "typecheck": "tsc --watch" }, "dependencies": { "@react-native-community/async-storage": "^1.12.1", "@react-native-community/checkbox": "^0.5.5", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/masked-view": "^0.1.10", "@react-native-firebase/admob": "^10.1.0", "@react-native-firebase/app": "^10.0.0", "@react-navigation/drawer": "^5.10.1", "@react-navigation/native": "^5.8.1", "@react-navigation/stack": "^5.11.0", "react": "16.13.1", "react-native": "0.63.3", "react-native-autocomplete-input": "^4.2.0", "react-native-elements": "^3.0.0-alpha.1", "react-native-geolocation-service": "^5.0.0", "react-native-gesture-handler": "^1.8.0", "react-native-image-picker": "^2.3.4", "react-native-ionicons": "^4.x", "react-native-keyboard-aware-scroll-view": "^0.9.3", "react-native-maps": "^0.27.1", "react-native-modal": "^11.5.6", "react-native-paper": "^4.2.0", "react-native-reanimated": "^1.13.1", "react-native-safe-area-context": "^3.1.8", "react-native-screens": "^2.12.0", "react-native-share": "^4.0.4", "react-native-simple-toast": "^1.1.3", "react-native-svg": "^12.1.0", "react-native-vector-icons": "^7.1.0", "react-native-view-shot": "^3.1.2" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^1.1.0", "@types/jest": "^26.0.15", "@types/react": "^16.9.55", "@types/react-native": "^0.63.30", "@types/react-native-autocomplete-input": "^4.0.1", "@types/react-native-share": "^3.3.0", "@types/react-test-renderer": "^16.9.3", "babel-jest": "^25.1.0", "eslint": "^6.5.1", "eslint-plugin-react-hooks": "^4.2.0", "jest": "^25.1.0", "metro-react-native-babel-preset": "^0.59.0", "react-devtools": "^4.9.0", "react-native-svg-transformer": "^0.14.3", "react-test-renderer": "16.13.1", "typescript": "^4.0.5" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '10.0' target 'DailyBreath' do config = use_native_modules! pod 'Google-Mobile-Ads-SDK' use_react_native!(:path => config["reactNativePath"]) pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'react-native-maps', :path => '../node_modules/react-native-maps' pod 'react-native-geolocation', :path => '../node_modules/@react-native-community/geolocation' pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage' target 'DailyBreathTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. use_flipper! post_install do |installer| flipper_post_install(installer) end end target 'DailyBreath-tvOS' do # Pods for DailyBreath-tvOS target 'DailyBreath-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #ifdef FB_SONARKIT_ENABLED #import #import #import #import #import #import static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } #ifdef FB_SONARKIT_ENABLED InitializeFlipper(application); #endif RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"DailyBreath" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.6 CPU: (4) x64 Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz Memory: 43.43 MB / 4.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.19.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.8 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.10.0 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild Languages: Java: Not Found Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 10.0.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. AdMob` - **Are you using `TypeScript`?** - `N` & `VERSION`


mikehardy commented 3 years ago

You have mis-matched versions - I converted react-native-firebase to a unified versioning style recently and you should never do this:

    "@react-native-firebase/admob": "^10.1.0",
    "@react-native-firebase/app": "^10.0.0",

10.1.0 (or, the same version) for all now

More importantly, it builds and runs just fine, I can't reproduce after trying just now with https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh - there is something wrong with your local project

Check to make sure you have not override firebase-ios-sdk or if you do that it is current (7.1.0), npx react-native-clean-project etc.

If you can reproduce with the demo script I can re-open to investigate

schachris commented 3 years ago

I get the same error when running for Mac Catalyst.

mikehardy commented 3 years ago

@cschaffr I believe that is not related to the original issue at all. I just checked the installed framework from google mobile ads and your root cause will be that Google Mobile Ads does not package a catalyst version of their ios cocoapod framework, so it will not work as a native compile. You'll have to exclude that pod (and any use of related APIs) from catalyst builds. You can see that by looking in the .xcframework folder of the installed google mobile ads pod in your project, no catalyst directory

anmolpandeyy commented 3 years ago

@mikehardy I'm getting the same issue on version 10.1.0 but it still says ''GoogleMobileAds/GoogleMobileAds.h' file not found' in RNFBAdMob target when I'm running a release scheme, it works in debug though. I'm on Xcode 12.3 any idea?

"@react-native-firebase/admob": "10.1.0", "@react-native-firebase/analytics": "10.1.0", "@react-native-firebase/app": "10.1.0", "@react-native-firebase/crashlytics": "10.1.0", "@react-native-firebase/dynamic-links": "10.1.0", "@react-native-firebase/in-app-messaging": "10.1.0", "@react-native-firebase/messaging": "10.1.0", "@react-native-firebase/perf": "10.1.0", "@react-native-firebase/remote-config": "10.1.0",

mikehardy commented 3 years ago

Still builds fine in our ci and my demo script, so no idea what's wrong sorry