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

[🐛] Ads appear in "Test Mode" in the App I Published! #475

Closed furkancelik closed 1 year ago

furkancelik commented 1 year ago

What happened?

Hello,

I am using the "react-native-google-mobile-ads" package, but my ads are visible in the test environment, but they are not showing when I publish the application...

When adding ad units, I had selected the "Test Mode" checkbox for the "Ad mediation" system, and my ads were not displayed. Later, I removed this checkbox and re-added my ad units.

admob-1

Admob provides data in the overview of the application, but my ads are not displaying in my published application.

admob-2

As I changed the ad units as specified, my published application is now showing ads in "Test Mode."

IMG_6441

How can I fix this error? All my ads are displaying in this manner.

Platforms

Only on iOS

React Native Info

System:
  OS: macOS 13.3
  CPU: (10) arm64 Apple M2 Pro
  Memory: 71.95 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.1
    path: ~/.nvm/versions/node/v18.16.1/bin/node
  Yarn:
    version: 1.22.19
    path: ~/Desktop/PoliceLight/node_modules/.bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.16.1/bin/npm
  Watchman:
    version: 2023.06.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/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: Not Found
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/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

{
  "name": "*****",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios --scheme PoliceLight",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@adrianso/react-native-device-brightness": "^1.2.7",
    "@klarna/react-native-vector-drawable": "^0.4.0",
    "@react-native-async-storage/async-storage": "^1.19.3",
    "@react-native-firebase/analytics": "^18.6.0",
    "@react-native-firebase/app": "^18.6.0",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "react": "18.2.0",
    "react-native": "0.72.4",
    "react-native-google-mobile-ads": "^12.2.0",
    "react-native-iap": "^12.10.8",
    "react-native-safe-area-context": "^4.7.2",
    "react-native-screen-brightness": "^2.0.0-alpha",
    "react-native-screens": "^3.25.0",
    "react-native-sound": "^0.11.2",
    "react-native-svg": "^13.13.0",
    "react-native-svg-transformer": "^1.1.0",
    "react-native-vector-image": "^0.4.4",
    "react-native-wheel-color-picker": "^1.2.0",
    "yarn": "^1.22.19"
  },
  "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/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }
}

app.json

{
  "name": "PoliceLight",
  "displayName": "PoliceLight",
  "react-native-google-mobile-ads": {
  "android_app_id": "ca-app-pub-0000000000000000~0000000000", 
  "ios_app_id": "ca-app-pub-0000000000000000~0000000000" //Here is my real application ID value.
  }
}

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!

# 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 'PoliceLight' do

  config = use_native_modules!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

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

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :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,
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  # right after `use_frameworks! :linkage => :static

  target 'PoliceLightTests' 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
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

mikehardy commented 1 year ago

I think this is a general "google ads" question and you are going to need to look to them or stackoverflow for support as general admob user support is not something we handle here

We have general reasons here https://docs.page/invertase/react-native-google-mobile-ads/common-reasons-for-ads-not-showing but we cannot troubleshoot every user's difficulties showing test ads or not showing ads.

If ads are shown at all, then this repository is doing it's job and there is not really anything actionable here for us that would cause a change in the code, so this is close-able