invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

v6 Failed to show BannerAd: ReactNativeFirebaseAdMobBannerView was not found in the UIManager. #2603

Closed alvaro1728 closed 5 years ago

alvaro1728 commented 5 years ago

My dependencies:

"@react-native-firebase/admob": "^0.5.2",
"@react-native-firebase/app": "^0.5.2",
"react": "16.8.6",
"react-native": "0.60.2"

My code:

import {BannerAd} from '@react-native-firebase/admob';
...
    return (
      <View style={styles.container}>
        <BannerAd unitId="ca-app-pub-3940256099942544/2934735716" size="banner" />
      </View>
    );

The run-time error:

Unhandled JS Exception: Invariant Violation: requireNativeComponent: "ReactNativeFirebaseAdMobBannerView" was not found in the UIManager.

This error is located at: in ReactNativeFirebaseAdMobBannerView (at BannerAd.js:90) in BannerAd (at App.js:51) in RCTView (at View.js:35) in View (at App.js:39) in App (at renderApplication.js:40) in RCTView (at View.js:35) in View (at AppContainer.js:98) in RCTView (at View.js:35) in View (at AppContainer.js:115) in AppContainer (at renderApplication.js:39)

Thanks, Alvaro

eraytes commented 5 years ago

Same problem. It seems all ad types(banner, interstitial, rewarded) fail. Is there anybody who confirms V6 Admob works?

"dependencies": { "@react-native-firebase/admob": "^6.0.0", "@react-native-firebase/app": "^6.0.0", "react": "16.9.0", "react-native": "0.61.1" }

Ehesp commented 5 years ago

AdMob is tricky to properly test, however it has all been working from our local tests.

Can you delete your Podfile.lock and run a pod install --repo-update to ensure all of the files for the project are being imported.

This file works on both Android & iOS: https://github.com/invertase/react-native-firebase/blob/master/tests/app.admob.js#L109

alvaro1728 commented 5 years ago

I can confirm that it's been fixed with 6.0.0. Thanks!

djpetenice commented 5 years ago

I'm getting the same error message on my Android build and I'm using 6.0.1 - anyone know of a solution?

fcostaprojects commented 5 years ago

Same issue in android test:

"@react-native-firebase/admob": "^6.0.2", "@react-native-firebase/app": "^6.0.2", "react-native": "0.61.2",

import { BannerAd, BannerAdSize, TestIds } from '@react-native-firebase/admob';

<BannerAd unitId={TestIds.BANNER} size={BannerAdSize.BANNER} request={{}} onAdLoaded={() => console.log('loaded')} onAdFailedToLoad={e => console.log('failed to load', e)} />

fcostaprojects commented 5 years ago

Solution update: MainApplication.java

old version:

import com.facebook.react.shell.MainReactPackage;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

        @Override
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;
        }

    @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
              new MainReactPackage(),
          new RNFirebasePackage(),  
       );

new version:

import com.facebook.react.PackageList;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {

        @Override
        public boolean getUseDeveloperSupport() {
          return BuildConfig.DEBUG;
        }

    @Override
        protected List<ReactPackage> getPackages() {
          List<ReactPackage> packages = new PackageList(this).getPackages();
          return packages;
        }

Work fine!

kostiantyn-solianyk commented 4 years ago

I have the same error on android

jatinhemnani commented 4 years ago

anyone find the solution need help..

ahmdshrif commented 3 years ago

I solve it in android by 1- upgrade all react native firebase packages

2- clean android build

cd android && gradlew clean

3- reinstall app in android emulator

yarn android

AWAIS-514 commented 2 years ago

anyone solve this???????????????????

mikehardy commented 2 years ago

@Hassan-Hmc use https://github.com/invertase/react-native-google-ads - admob is no longer a part of firebase upstream or here, the code has been extracted and lives in that repo now