invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
673 stars 135 forks source link

[🐛] [IOS] Build Error after installation of this library #630

Closed s-mikulich closed 1 month ago

s-mikulich commented 1 month ago

What happened?

Build is down after installation this library.

XCode Version 15.1 "react-native": "0.74.2", "react-native-google-mobile-ads": "^14.2.2",

Screenshot 2024-08-14 at 20 54 12

Platforms

Only on iOS

React Native Info

"react-native": "0.74.2"

Are your using Typescript?

package.json

{
  "name": "",
  "version": "",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "pod": "cd ios && pod install && ../",
    "test": "jest",
    "check-typescript": "tsc --noEmit",
    "check-eslint": "eslint './src/**/*{js,ts,jsx,tsx}' --fix",
    "lint": "yarn check-typescript && yarn check-eslint",
    "release": "standard-version",
    "prepare": "husky"
  },
  "dependencies": {
    "@adapty/react-native-ui": "^2.11.0",
    "@react-native-async-storage/async-storage": "^1.23.1",
    "@react-native-community/blur": "^4.4.0",
    "@react-native-community/netinfo": "^11.3.2",
    "@react-native-firebase/analytics": "^20.2.0",
    "@react-native-firebase/app": "^20.2.0",
    "@react-native-firebase/crashlytics": "^20.2.0",
    "@react-native-firebase/remote-config": "^20.2.0",
    "@react-navigation/bottom-tabs": "^6.5.20",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.9.26",
    "@shopify/react-native-skia": "^1.3.6",
    "axios": "^1.7.2",
    "date-fns": "^3.6.0",
    "i18n-iso-countries": "^7.11.2",
    "i18next": "^23.11.5",
    "jotai": "^2.8.3",
    "numeral": "^2.0.6",
    "react": "18.3.1",
    "react-i18next": "^14.1.2",
    "react-native": "0.74.2",
    "react-native-adapty": "^2.11.0",
    "react-native-auto-size-text": "^1.1.1",
    "react-native-bootsplash": "^5.5.3",
    "react-native-device-info": "^11.1.0",
    "react-native-draggable-flatlist": "^4.0.1",
    "react-native-gesture-handler": "^2.17.1",
    "react-native-google-mobile-ads": "^14.2.2",
    "react-native-graph": "^1.1.0",
    "react-native-localize": "^3.2.0",
    "react-native-orientation-locker": "^1.7.0",
    "react-native-reanimated": "^3.12.1",
    "react-native-safe-area-context": "^4.10.5",
    "react-native-screens": "^3.32.0",
    "react-native-svg": "^15.3.0",
    "react-native-swipeable-item": "^2.0.9",
    "react-native-toast-message": "^2.2.0",
    "react-native-tracking-transparency": "^0.1.2",
    "react-native-uuid": "^2.0.2",
    "react-native-vector-icons": "^10.1.0",
    "styled-components": "^6.1.11"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@commitlint/cli": "^19.3.0",
    "@commitlint/config-conventional": "^19.2.2",
    "@react-native/babel-preset": "0.74.83",
    "@react-native/eslint-config": "0.74.83",
    "@react-native/metro-config": "0.74.83",
    "@react-native/typescript-config": "0.74.83",
    "@trivago/prettier-plugin-sort-imports": "^4.3.0",
    "@types/numeral": "^2.0.5",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "@types/styled-components-react-native": "^5.2.5",
    "@typescript-eslint/eslint-plugin": "^7.10.0",
    "@typescript-eslint/parser": "^7.10.0",
    "babel-jest": "^29.6.3",
    "babel-plugin-module-resolver": "^5.0.2",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "8.57.0",
    "eslint-config-universe": "^12.1.0",
    "eslint-import-resolver-typescript": "^3.6.1",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-react-hooks": "^4.6.2",
    "husky": "^9.0.11",
    "jest": "^29.6.3",
    "lint-staged": "^15.2.5",
    "metro-react-native-babel-preset": "^0.77.0",
    "prettier": "^3.2.5",
    "react-native-svg-transformer": "^1.4.0",
    "react-test-renderer": "18.2.0",
    "standard-version": "^9.5.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  },
  "packageManager": "yarn@3.6.4",
  "lint-staged": {
    "**/*.{js,jsx,ts,tsx}": [
      "eslint './src/**/*{js,ts,jsx,tsx}' --fix",
      "prettier --write './src/**/*{js,ts,jsx,tsx}'"
    ]
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

app.json

{
  "name": "converter",
  "displayName": "converter",
  "react-native-google-mobile-ads": {
    "ios_app_id": "ca-app-pub-1179367564318969~1277203162"
  }
}

ios/Podfile

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'converter' do  
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'FirebaseCrashlytics', :modular_headers => true
  pod 'FirebaseRemoteConfig', :modular_headers => true
  pod 'FirebaseSessions', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'FirebaseABTesting', :modular_headers => true

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

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

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

dylancom commented 1 month ago

Xcode 15.3 should be used.

See: https://developers.google.com/admob/ios/rel-notes

11.6.0 Added a dependency on MarketplaceKit. This requires apps to build with Xcode 15.3 or above. MarketplaceKit is Swift-only, so a Swift placeholder file has been added to the distribution so Swift standard libraries are included in apps even if they don't contain other Swift files.

s-mikulich commented 1 month ago

Yes, you are right! This problem was resolved by upgrading the version of Xcode. Thanks!!