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

[🐛] pthread-kill - The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publisher #552

Closed minuk3508 closed 1 week ago

minuk3508 commented 4 months ago

What happened?

스크린샷 2024-02-25 오후 12 52 14

The error appears in xcode. Why is this? Google App Advertising ID I wrote it in the app.json file. I also added it to info.plist.

Platforms

Only on iOS

React Native Info

System:
  OS: macOS 14.3.1
  CPU: (11) arm64 Apple M3 Pro
  Memory: 75.64 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.21
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/gimmin-ug/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: /Users/gimmin-ug/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.2
    wanted: 0.73.2
  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": "ticketty",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "install-package": "yarn && cd ios && pod deintegrate && pod install && cd ../",
    "remove-package": "sudo rm -rf node_modules/ && cd ios && rm -rf Pods/ && cd ../",
    "open-ios": "open ios/ticketty.xcworkspace",
    "open-aos": "open -a /Applications/Android\\ Studio.app ~/Documents/ticketty/android/",
    "clean-ios": "cd ios && pod cache clean --all && pod install --repo-update && cd ../",
    "clean-aos": "cd android && ./gradlew clean && cd ../"
  },
  "dependencies": {
    "react": "18.2.0",
    "react-native": "0.73.2",
    "react-native-google-mobile-ads": "^13.0.1",
    "react-native-permissions": "^4.1.4",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-webview": "^13.6.4"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.73.19",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.3",
    "@react-native/typescript-config": "0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  },
  "main": "index.js",
  "author": "김민욱 <minuk3508@gamil.com>",
  "license": "MIT"
}

app.json

{
  "name": "ticketty",
  "displayName": "ticketty",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-6191219268435767/1384079253",
    "ios_app_id": "ca-app-pub-6191219268435767/2102264558"
  }
}

ios/Podfile

#   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 'ticketty' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # 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}/.."
  )

  target 'tickettyTests' 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
    )
  end
end

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

AftabUfaq commented 3 months ago

I didn't call the initiilze ads and still ads are showing

import React from 'react';
import Geolocation from 'react-native-geolocation-service';
import SplashScreen from 'react-native-splash-screen';
import Toast from 'react-native-toast-message';
import {Provider} from 'react-redux';
import {PersistGate} from 'redux-persist/integration/react';
import MainApp from './src/navigation';
import {persistor, store} from './src/store/index';
import {useAppOpenAd} from './src/hooks/appopenAdhook';
import {useEffect} from 'react';
import mobileAds, {MaxAdContentRating} from 'react-native-google-mobile-ads';
import callGdprConsent from './src/logic/callGdprConsent';
import { GestureHandlerRootView } from 'react-native-gesture-handler'
Geolocation.setRNConfiguration({
  config: {
    skipPermissionRequests: true,
    authorizationLevel: 'auto',
    locationProvider: 'auto',
  },
});
const App2 = () => {
  const {ad_closed, loading} = useAppOpenAd();
  useEffect(() => {
    if (ad_closed) {
      SplashScreen.hide();
    }
    if (!loading) {
      SplashScreen.hide();
    }
  }, [ad_closed, loading]);

  return <MainApp />;
};

const App = () => {

  const initGdpConsent = async () => {
    try {
      let dd =  await callGdprConsent()
    console.log(dd ,"Ads Consent");
    } catch (error) {
      console.log(error ,"ERROR");
    }
  }

  const initilizeAdsModules = () => {
    mobileAds()
      .setRequestConfiguration({
        maxAdContentRating: MaxAdContentRating.PG,
        tagForChildDirectedTreatment: true,
        tagForUnderAgeOfConsent: true,
        testDeviceIdentifiers: ['EMULATOR'],
      })
      .then(() => {
        mobileAds()
          .initialize()
          .then(adapterStatuses => {});
      });
  };
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor} onBeforeLift={() => {}}>
        <App2 />
      </PersistGate>
      <Toast />
    </Provider>
    </GestureHandlerRootView>
  );
};
export default App;
github-actions[bot] commented 2 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.

AftabUfaq commented 2 months ago

same issue m.any solution for this

github-actions[bot] commented 1 month 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.

AftabUfaq commented 1 month ago

not yet resolved

github-actions[bot] commented 4 weeks 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.