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
671 stars 135 forks source link

[🐛] [Error: [googleMobileAds/no-fill] Request Error: No ad to show.] #430

Closed dessorry closed 1 year ago

dessorry commented 1 year ago

What happened?

recently, every time I launch my App on iOS simulator I can no longer show the rewarded ads. No problem instead on Android emulator. I always get error: [Error: [googleMobileAds/no-fill] Request Error: No ad to show.] I have no error or block in Admob. Both my ads (ios and android) are ready.

Thanks

Platforms

Only on iOS

React Native Info

System:
    OS: macOS 13.3.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 445.95 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.9.0 - /opt/homebrew/bin/node
    Yarn: Not Found
    npm: 8.19.1 - /opt/homebrew/bin/npm
    Watchman: 2022.09.12.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /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: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: ^6.1.0 => 6.4.0 
    react: 17.0.2 => 17.0.2 
    react-native: 0.65.3 => 0.65.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Are your using Typescript?

package.json

{
  "name": "XXX",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@freakycoder/react-native-bounceable": ">= 0.1.1",
    "@react-native-async-storage/async-storage": "^1.17.3",
    "@react-native-community/cli": "^6.1.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/drawer": "^6.3.1",
    "@react-navigation/native": "^6.0.0",
    "@react-navigation/stack": "^5.14.3",
    "expo": "^41.0.1",
    "expo-cli": "^4.4.4",
    "lottie-ios": "^3.2.3",
    "lottie-react-native": "^4.1.3",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.34",
    "react": "17.0.2",
    "react-native": "0.65.3",
    "react-native-animated-bottom-drawer": "^0.0.22",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-google-mobile-ads": "10.1.0",
    "react-native-raw-bottom-sheet": "^2.2.0",
    "react-native-reanimated": "^1.13.4",
    "react-native-rounded-checkbox": "^0.3.3",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^3.0.0",
    "react-native-swipe-list-view": "^3.2.9",
    "react-native-switch-selector": "^2.3.0",
    "react-native-view-shot": "^3.7.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "@types/jest": "^29.5.2",
    "@types/react": "^18.2.14",
    "@types/react-native": "^0.72.2",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-native-codegen": "^0.0.12",
    "react-test-renderer": "17.0.2",
    "typescript": "^5.1.3"
  },
  "jest": {
    "preset": "react-native"
  }
}

app.json

{
  "name": "XXX",
  "displayName": "XXX",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-XXX~YYY",
    "ios_app_id": "ca-app-pub-XXX~YYY"
  }
}

ios/Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'

target 'XXX' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

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

  target 'XXXTests' 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)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        # Disable arm64 builds for the simulator
        config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
      end
    end
  end
end

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

  target 'XXX-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  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 year ago

Not sure why but switching to a different simulator sometimes helps. npx react-native run-ios --simulator="iPhone 14 Pro"

dessorry commented 1 year ago

Thanks, but I've just tried this solution. Also iOS real device doesn't show ads.

dylancom commented 1 year ago

https://github.com/invertase/react-native-google-mobile-ads/issues/349#issuecomment-1481390392

dylancom commented 1 year ago

No problems in our example app so please compare.

Scherm­afbeelding 2023-08-07 om 10 37 14
dessorry commented 1 year ago

I tried to use TestIds.REWARDED but I obtained: [Error: [googleMobileAds/no-fill] Request Error: No ad to show.] How can I add some logs to debug reason? Where can I found code of your example?

dessorry commented 1 year ago

An app-ads.txt file is mandatory to get Ads?

dylancom commented 1 year ago

If people would start to read our docs we'd avoid many issues 🤷‍♂️. https://docs.page/invertase/react-native-google-mobile-ads/common-reasons-for-ads-not-showing#test-ads-not-showing-up

dessorry commented 1 year ago

If you set up an app-ads.txt....

"If you"

I'm still wondering if it is mandatory or not. I would not use app-ads.txt, is possible? I've read your docs (it's very clear and detailed) and everything works for two years. Since last week it suddenly stops to work on iOS so I'm trying to figure it out what could be the reason

dylancom commented 1 year ago

Ah oke, I thought it was mandatory but the official admob docs say it's "recommended". Would try the official admob forums as there are many people having "no-fill" errors with rewarded ads for different reasons. (unrelated to this react native port)

dessorry commented 1 year ago

OK, thanks, I'll try on AdMob community

dessorry commented 1 year ago

I solved the issue uploading a goog app-ads.txt So we can say that:

APP-ADS.TXT IS MANDATORY FOR iOS!

Thank you for you help and forgive me if I post here an issue that is caused by me. You can close this issue!