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
698 stars 142 forks source link

[🐛] Bug Report Title - Updating from version 6 -> anything above 9 errors #465

Closed sdb1228 closed 11 months ago

sdb1228 commented 1 year ago

What happened?

Updating from version 6.0.1 -> anything above 9 gives the error below

There is no XCFramework found at '/ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework'.

Platforms

Only on iOS

React Native Info

System:
  OS: macOS 13.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 118.00 MB / 32.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 18.17.1
    path: ~/.volta/tools/image/node/18.17.1/bin/node
  Yarn:
    version: 1.22.17
    path: ~/.volta/tools/image/yarn/1.22.17/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.volta/tools/image/node/18.17.1/bin/npm
  Watchman:
    version: 2023.03.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/stevenburnett/.gem/ruby/3.2.2/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9477386
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.17
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/stevenburnett/.rubies/ruby-3.2.2/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Are your using Typescript?

package.json

{
  "name": "PrettyRandom",
  "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 ."
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.34",
    "@fortawesome/free-solid-svg-icons": "^5.15.2",
    "@fortawesome/react-native-fontawesome": "^0.2.6",
    "@react-native-async-storage/async-storage": "^1.15.2",
    "@react-native-community/checkbox": "^0.5.16",
    "buffer": "^6.0.3",
    "chance": "^1.1.7",
    "csv-string": "^4.0.1",
    "i18n-js": "^3.8.0",
    "lodash": "^4.17.21",
    "react": "18.2.0",
    "react-native": "0.72.5",
    "react-native-animatable": "^1.3.3",
    "react-native-config": "^1.4.2",
    "react-native-document-picker": "^8.0.0",
    "react-native-drawer": "^2.5.1",
    "react-native-flash-message": "^0.1.23",
    "react-native-fs": "^2.19.0",
    "react-native-google-mobile-ads": "^6.1.0",
    "react-native-idle-timer": "^2.1.7",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^2.0.2",
    "react-native-permissions": "^3.0.4",
    "react-native-popover-view": "^5.1.6",
    "react-native-purchases": "^6.6.5",
    "react-native-shake": "^3.5.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^12.1.1-0",
    "stream": "^0.0.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "@tsconfig/react-native": "^3.0.0",
    "@types/jest": "^29.2.1",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "axios": "^0.26.0",
    "babel-jest": "^29.2.1",
    "detox": "^18.18.1",
    "detox-getprops": "^0.1.2",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "jest-circus": "^27.0.6",
    "metro-react-native-babel-preset": "0.76.8",
    "react-test-renderer": "18.2.0"
  },
  "engines": {
    "node": ">=16"
  },
  "jest": {
    "preset": "react-native"
  }
}

app.json

{
  "name": "PrettyRandom",
  "displayName": "PrettyRandom",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-46XXXX~XXX",
    "ios_app_id": "ca-app-pub-XXXX~XXX",
    "user_tracking_usage_description": "This identifier will be used to deliver personalized ads to you."
  }
}

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

permissions_path = "../node_modules/react-native-permissions/ios"

pod "Permission-AppTrackingTransparency", :path => "#{permissions_path}/AppTrackingTransparency"

pod "RNPurchases", :path => "../node_modules/react-native-purchases"

platform :ios, min_ios_version_supported
prepare_react_native_project!
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# 
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# 
flipper_config = ENV["NO_FLIPPER"] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
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 "PrettyRandom" do
  config = use_native_modules!
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
  )

  pod "RNCAsyncStorage", :path => "../node_modules/@react-native-async-storage/async-storage"

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"] ||= ["$(inherited)", "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"]
      end
    end
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

android/build.gradle

.

android/app/build.gradle

.

android/settings.gradle

.

AndroidManifest.xml

.
dylancom commented 1 year ago

Your pods are behind. cd ios && pod install --repo-update

sdb1228 commented 1 year ago

@dylancom I have tried that I usually get

[!] CocoaPods could not find compatible versions for pod "GoogleUserMessagingPlatform":
  In snapshot (Podfile.lock):
    GoogleUserMessagingPlatform (= 2.1.0, >= 1.1)

  In Podfile:
    RNGoogleMobileAds (from `../node_modules/react-native-google-mobile-ads`) was resolved to 10.3.2, which depends on
      GoogleUserMessagingPlatform (= 2.0.1)

You have either:
 * changed the constraints of dependency `GoogleUserMessagingPlatform` inside your development pod `RNGoogleMobileAds`.
   You should run `pod update GoogleUserMessagingPlatform` to apply changes you've made.

After deleting my podfile.lock and reinstalling I can't run anymore given I get

   There is no XCFramework found at '/Users/stevenburnett/projects/NoExpoPrettyRandom/ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework'.
github-actions[bot] commented 11 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.