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
625 stars 121 forks source link

[šŸ›] Interstitial are not loading - v13.3.0 - blocking release #577

Closed MadeinFrance closed 1 month ago

MadeinFrance commented 1 month ago

What happened?

Given: a release build: react-native run-android --mode=release


Then: the interstitial Ad is not loading anymore. (In previous version v12 the following code was working, now in v13 isLoaded is never true.)

Kotlin version: 1.9.22 RN: 0.74.1

const requestOptions: RequestOptions = {
  requestNonPersonalizedAdsOnly: false,
  keywords: getAdKeywords(),
}
const { isLoaded, load, show, error } = useInterstitialAd(interstitialAdUnitId,requestOptions)

Platforms

Android and iOS

React Native Info

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 97.02 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.1.0
    path: ~/.nvm/versions/node/v21.1.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v21.1.0/bin/yarn
  npm:
    version: 10.4.0
    path: ~/.nvm/versions/node/v21.1.0/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/x/.gem/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-30 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-UpsideDownCake-ext5 | Google APIs ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11709847
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.3
    path: /opt/homebrew/opt/openjdk/bin/javac
  Ruby:
    version: 3.3.1
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  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

"react-native-google-mobile-ads": "^13.3.0",
"react-native": "0.74.1",

app.json

BARE

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

MadeinFrance commented 1 month ago

Ok so useInterstitialAd is not working as expected. It seems like the LOADED event is triggered when using the non-hook version:

  // const { isLoaded, load, show, error } = useInterstitialAd(
  //   interstitialAdUnitId,
  //   requestOptions
  // )
  const interstitial = InterstitialAd.createForAdRequest(
    interstitialAdUnitId,
    requestOptions
  )
dylancom commented 1 month ago

Oke, feel free to submit a PR and improve this community effort :)

dylancom commented 1 month ago

Just tested, working fine in the example app.

MadeinFrance commented 1 month ago

Hi @dylancom thanks for testing, do you think the version mismatch for this issue and the example App, could be a potential reason? v74 / v72

dylancom commented 1 month ago

I ran .refresh-example.sh right before testing which makes sure that the example app is on the latest RN (0.74)

dylancom commented 1 month ago

Does this only happen in release mode? The example app has been updated btw.

MadeinFrance commented 1 month ago

Yes release mode. Next week, I can try to debug with the example App and my IDs.

MadeinFrance commented 1 month ago

it works as expected with the demo project šŸ‘