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
636 stars 128 forks source link

[🐛] Test ads not showing on iOS after upgrade. Showing on Android #447

Closed andrisole92 closed 9 months ago

andrisole92 commented 10 months ago

What happened?

Just upgraded to expo 49 and react-native-google-mobile-ads 12.1.1 - test ads are showing on Android but not on iOS.

Platforms

Only on iOS

React Native Info

System:
  OS: macOS 13.5.1
  CPU: (8) arm64 Apple M1
  Memory: 97.48 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 16.10.0
    path: ~/.nvm/versions/node/v16.10.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v16.10.0/bin/yarn
  npm:
    version: 7.24.0
    path: ~/.nvm/versions/node/v16.10.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/andrejsruz/.rvm/rubies/ruby-3.1.2/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2021.3 AI-213.7172.25.2113.9123335
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2
    path: /opt/homebrew/opt/openjdk/bin/javac
  Ruby:
    version: 3.1.2
    path: /Users/andrejsruz/.rvm/rubies/ruby-3.1.2/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  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

{
  "main": "index.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test:unit": "jest ./src",
    "prebuild:android": "npx expo prebuild --platform android",
    "prebuild:ios": "npx expo prebuild --platform ios",
    "build:android": "eas build --platform android",
    "build:ios": "eas build --platform ios",
    "submit:android": "eas submit --platform android",
    "submit:ios": "eas submit --platform ios"
  },
  "dependencies": {
    "@amplitude/react-native": "^2.17.0",
    "@config-plugins/react-native-webrtc": "^7.0.0",
    "@expo/react-native-action-sheet": "^3.13.0",
    "@expo/vector-icons": "^13.0.0",
    "@miblanchard/react-native-slider": "^2.0.2",
    "@rails/actioncable": "^6.1.4-1",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-community/hooks": "^2.8.1",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-firebase/analytics": "~16.5.0",
    "@react-native-firebase/app": "~16.5.0",
    "@react-native-firebase/app-check": "~16.5.0",
    "@react-native-firebase/crashlytics": "~16.5.0",
    "@react-native-firebase/perf": "~16.5.0",
    "@react-native-firebase/remote-config": "~16.5.0",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/material-top-tabs": "^6.2.2",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/native-stack": "^6.0.10",
    "@react-navigation/stack": "^6.0.10",
    "@react-spring/native": "^9.6.1",
    "@shopify/flash-list": "1.4.3",
    "@svanboxel/visibility-sensor-react-native": "^1.0.2",
    "big-integer": "^1.6.51",
    "buffer": "^6.0.3",
    "dayjs": "^1.11.7",
    "expo": "~49.0.6",
    "expo-2d-context": "^0.0.3",
    "expo-application": "~5.3.0",
    "expo-av": "~13.4.1",
    "expo-build-properties": "~0.8.3",
    "expo-camera": "~13.4.2",
    "expo-checkbox": "~2.4.0",
    "expo-constants": "~14.4.2",
    "expo-dev-client": "~2.4.8",
    "expo-device": "~5.4.0",
    "expo-font": "~11.4.0",
    "expo-gl": "~13.0.1",
    "expo-haptics": "~12.4.0",
    "expo-image-loader": "~4.3.0",
    "expo-image-manipulator": "~11.3.0",
    "expo-image-picker": "~14.3.2",
    "expo-in-app-purchases": "~14.3.0",
    "expo-linear-gradient": "~12.3.0",
    "expo-linking": "~5.0.2",
    "expo-notifications": "~0.20.1",
    "expo-secure-store": "~12.3.1",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "expo-system-ui": "~2.4.0",
    "expo-tracking-transparency": "~3.1.0",
    "expo-updates": "~0.18.12",
    "lottie-react-native": "5.1.6",
    "node-forge": "^1.3.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.30.0",
    "react-native": "0.72.4",
    "react-native-actioncable": "^0.0.3",
    "react-native-actions-sheet": "^0.8.21",
    "react-native-confetti-cannon": "^1.5.2",
    "react-native-draggable-grid": "^2.1.7",
    "react-native-fast-image": "^8.5.11",
    "react-native-fbsdk-next": "^11.2.1",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-google-mobile-ads": "^12.1.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keyboard-aware-scrollview": "^2.1.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-pager-view": "6.2.0",
    "react-native-paper": "^4.9.2",
    "react-native-popup-menu": "^0.15.13",
    "react-native-purchases": "^5.13.1",
    "react-native-reanimated": "~3.3.0",
    "react-native-root-toast": "^3.4.1",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "13.9.0",
    "react-native-swipe-list-view": "^3.2.9",
    "react-native-tab-view": "^3.1.1",
    "react-native-ui-lib": "^6.13.0",
    "react-native-web": "~0.19.6",
    "react-native-webrtc": "111.0.3",
    "text-encoding": "^0.7.0",
    "tiny-emitter": "^2.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@config-plugins/detox": "^4.0.0",
    "@faker-js/faker": "^7.6.0",
    "@testing-library/dom": "^9.2.0",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/jest-native": "^5.4.2",
    "@testing-library/react-native": "^12.0.1",
    "@testing-library/user-event": "^14.4.3",
    "@types/jest": "^29.4.0",
    "@types/react": "~18.2.14",
    "@types/react-dom": "~18.0.8",
    "@types/react-native-snap-carousel": "^3.8.5",
    "@types/react-native-webrtc": "^1.75.5",
    "@typescript-eslint/eslint-plugin": "^5.5.0",
    "@typescript-eslint/parser": "^5.5.0",
    "babel-plugin-module-resolver": "^5.0.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "babel-root-slash-import": "^1.1.0",
    "core-js": "^3.30.0",
    "detox": "^20.3.0",
    "detox-expo-helpers": "^0.6.0",
    "eslint": "^8.3.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-plugin-absolute-imports": "^0.0.3",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.3.0",
    "expo-detox-hook": "^1.0.10",
    "jest": "^29.2.1",
    "jest-expo": "^48.0.1",
    "jest-fetch-mock": "^3.0.3",
    "mockdate": "^3.0.5",
    "prettier": "^2.5.0",
    "react-native-bundle-visualizer": "^3.1.1",
    "react-native-svg-transformer": "^1.0.0",
    "react-native-testing-library": "^6.0.0",
    "react-test-renderer": "^18.2.0",
    "ts-jest": "^29.0.5",
    "typescript": "^5.1.3",
    "wd": "^1.14.0",
    "webdriverio": "7.30.1"
  },
  "jest": {
    "preset": "jest-expo",
    "testEnvironment": "jsdom",
    "transformIgnorePatterns": [
      "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
    ],
    "setupFiles": [
      "<rootDir>/jest/setupJest.js"
    ],
    "setupFilesAfterEnv": [
      "<rootDir>/jest.env.js"
    ],
    "testMatch": [
      "<rootDir>/src/**/*.test.tsx"
    ],
    "moduleNameMapper": {
      "\\.svg": "<rootDir>/__mocks__/svgMock.js"
    }
  },
  "detox": {
    "test-runner": "jest",
    "configurations": {
      "ios.sim": {
        "binaryPath": "bin/SoulmeetMeetNewPeople.app",
        "type": "ios.simulator",
        "name": "iPhone SE"
      }
    }
  },
  "private": true,
  "name": "sm-rn",
  "version": "1.0.0"
}

app.json

{
    "expo": {
        "name": "***",
        "scheme": "***",
        "userInterfaceStyle": "light",
        "slug": "sm-rn",
        "version": "1.1.91",
        "orientation": "portrait",
        "icon": "./assets/icon.png",
        "backgroundColor": "#000000",
        "splash": {
            "image": "./assets/splash.png",
            "resizeMode": "cover",
            "backgroundColor": "#000000"
        },
        "updates": {
            "fallbackToCacheTimeout": 0,
            "url": "https://u.expo.dev/cbf342bd-e4db-4045-bc2d-de2b1f95a5a3"
        },
        "assetBundlePatterns": ["**/*"],
        "jsEngine": "hermes",
        "notification": {
            "icon": "./assets/icon_sq_96.png",
            "color": "#373092"
        },
        "ios": {
            "icon": "./assets/icon-ios2.png",
            "bundleIdentifier": "com.***.io",
            "associatedDomains": [
                "webcredentials:www.soulmeet.io",
                "webcredentials:soulmeet.io",
                "applinks:soulmeet.io"
            ],
            "supportsTablet": false,
            "googleServicesFile": "./GoogleService-Info.plist",
            "config": {
                "googleMobileAdsAppId": "ca-app-pub-***~9822555444"
            },
            "bitcode": false,
            "infoPlist": {
                "NSUserTrackingUsageDescription": "This identifier will be used to deliver personalized ads to you.",
                "SKAdNetworkItems": [
                    {
                        "SKAdNetworkIdentifier": "cstr6suwn9.skadnetwork"
                    }
                ]
            }
        },
        "android": {
            "package": "io.soulmeet.mobile",
            "googleServicesFile": "./google-services.json",
            "versionCode": 66,
            "intentFilters": [
                {
                    "action": "VIEW",
                    "autoVerify": true,
                    "data": [
                        {
                            "scheme": "https",
                            "host": "*.soulmeet.io",
                            "pathPrefix": "/*"
                        }
                    ],
                    "category": ["BROWSABLE", "DEFAULT"]
                }
            ],
            "adaptiveIcon": {
                "foregroundImage": "./assets/adaptive-icon.png",
                "backgroundColor": "#FFFFFF"
            },
            "permissions": [
                "BILLING",
                "RECORD_AUDIO",
                "CAMERA",
                "LOCATION",
                "android.permission.ACCESS_NETWORK_STATE",
                "android.permission.BLUETOOTH",
                "android.permission.BILLING",
                "android.permission.CAMERA",
                "android.permission.INTERNET",
                "android.permission.MODIFY_AUDIO_SETTINGS",
                "android.permission.RECORD_AUDIO",
                "android.permission.SYSTEM_ALERT_WINDOW",
                "android.permission.WAKE_LOCK",
                "com.google.android.gms.permission.AD_ID"
            ],
            "config": {
                "googleMobileAdsAppId": "ca-app-pub-***~5496028127"
            }
        },
        "web": {
            "favicon": "./assets/favicon.png"
        },
        "plugins": [
            ["./plugins/withModifyAndroidManifest.js"],
            ["./plugins/withModifyAppGradle.js"],
            ["./plugins/withAndroidVerifiedLinksWorkaround"],
            [
                "react-native-fbsdk-next",
                {
                    "appID": "***",
                    "clientToken": "***",
                    "displayName": "***",
                    "advertiserIDCollectionEnabled": true,
                    "autoLogAppEventsEnabled": true,
                    "isAutoInitEnabled": true
                }
            ],
            [
                "expo-tracking-transparency",
                {
                    "userTrackingPermission": "This identifier will be used to deliver personalized ads to you."
                }
            ],
            [
                "@config-plugins/detox",
                {
                    "subdomains": "*"
                }
            ],
            "@react-native-firebase/app",
            "@react-native-firebase/crashlytics",
            "@config-plugins/react-native-webrtc",
            [
                "expo-build-properties",
                {
                    "android": {
                        "compileSdkVersion": 33,
                        "targetSdkVersion": 33,
                        "buildToolsVersion": "33.0.0",
                        "enableProguardInReleaseBuilds": true,
                        "extraProguardRules": "-keep public class com.horcrux.svg.** {*;}\n\n# WebRTC\n-keep class com.cloudwebrtc.webrtc.** { *; }\n-keep class org.webrtc.** { *; }\n",
                        "allowBackup": false
                    },
                    "ios": {
                        "useFrameworks": "static"
                    }
                }
            ]
        ],
        "runtimeVersion": {
            "policy": "sdkVersion"
        },
        "extra": {
            "eas": {
                "projectId": "***"
            }
        }
    },
    "react-native-google-mobile-ads": {
        "android_app_id": "ca-app-pub-***",
        "ios_app_id": "ca-app-pub-***~9822555444"
    }
}

ios/Podfile

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0'
ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']

platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'
install! 'cocoapods',
  :deterministic_uuids => false

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,...), which will be excluded. To fix this,
# you can also exclude `react-native-flipper` in `react-native.config.js`
#
# 
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
#   }
# }
# 
flipper_config = FlipperConfiguration.disabled
if ENV['NO_FLIPPER'] == '1' then
  # Explicitly disabled through environment variables
  flipper_config = FlipperConfiguration.disabled
elsif podfile_properties.key?('ios.flipper') then
  # Configure Flipper in Podfile.properties.json
  if podfile_properties['ios.flipper'] == 'true' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"])
  elsif podfile_properties['ios.flipper'] != 'false' then
    flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] })
  end
end

target 'Soulmeet' do
  use_expo_modules!
  config = use_native_modules!

  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    :flipper_configuration => flipper_config
  )

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # This is necessary for Xcode 14, because it signs resource bundles by default
    # when building for devices.
    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|
      target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
        resource_bundle_target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

android/build.gradle

N/A

android/app/build.gradle

N/A

android/settings.gradle

N/A

AndroidManifest.xml

N/A
andrisole92 commented 10 months ago

Just tested version 8.2.2 works on both iOS and Android

andrisole92 commented 10 months ago

The last working version for iOS is 11.2.0.

v11.3.0 updates say: ios: sdk methods and banners on new architecture (3ee9d02) which breaks ads on iOS. They are just not showing up.

cc @dylancom

dylancom commented 10 months ago

Working fine here. Just created a new Expo project using: npx create-expo-app AdMobTest. Using: "expo": "~49.0.10"

Scherm­afbeelding 2023-09-11 om 14 28 40
github-actions[bot] commented 9 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.