React Native Admob Banner Error and its Solutions


Admob plays an important library for any App who wants to earns. Admob Banner is one of the simplest Admob to implement. It is a rectangular image or text ads that occupy a portion of the App's layout.

Sometimes we put the code correctly but steps as mention in instructions we face some issues. It may be related to the module, updated versions, crashes, library link issues, etc. I will discuss here stepwise step Admob Banner issues you may face.




Error-1

Invariant Violation: requireNativeComponent: "RNGADBannerView" was not found in the UIManager.







This error comes when you do not link Admob. As on GitHub Admob library installing instructions, they mentioned that 
''On Android the AdMob library code is part of Play Services, which is automatically added when this library is linked''.

But still, if we get this error. To Solve this issue, you have to do to just after installing AdMob or after getting this error you have to write this command on terminal.

Solution:


react-native link react-native-admob

Then run command react-native run-android, the problem will be solved.





Error-2

Android: The SDK Build Tools revision (23.0.1) is too low for the project ':react-native-social-share'. Minimum required is 25.0.0



Sorry to say after linked AdMob you may get this error instantly. This error comes when your SDK Build Tools revision is not updated or version is low.

Solution:

In Android Studio, I added the following to my root build gradle android/build.gradle


            android {
                compileSdkVersion 26
                buildToolsVersion '26.0.3'
            }
       ... }
    }
}
For not updated React Native version, You can use 25 instead of 26. 

Follow these Steps :

1. Open Android Studio, go to the folder, select Android then click on Ok Button


2. Click on an Ok button, Page will look like this


3. The Page will show like this:


 4. Click on Open File in Gradle Sync Issue, Page looks like this:



5. You have to edit compileSdkVersion and buildToolsVersion to 26, As Shown in Image:

  
6. Now Sync Gradle, wait for the Gradle Sync Process completed.
Go back to the terminal and use command react-native run-android.




Error-3


Invariant Violation: the Native component for “RNGADBannerView” does not exist...






This error comes when you apply a piece of code of AdMob Banner in View section and run your code.

Solution:
/node_modules/react-native-admob/android/src/main/java/com/sbugert/rnadmob/RNAdMobRewardedVideoAdModule.java



Delete @Override only from the above screenshot



Error-4

Internal Error, an invalid response was received from the ad server. 






This error comes when you complete all the above errors, then using AdMob code and run the command. Finally, you get this problem again. But this is a small fix.

Solution:

You have to connect to the internet. Turn on your Mobile data or Wi-Fi whatever you use. 

Ads show on App through the internet. It only displays Ads when the internet is available. That's why it took some time to load on App.



Here some example, which I created Apps on React Native with Admob Banner:







Thanks for Reading !!! 



Comments

  1. Hi there, when i have this error:

    error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted() in RewardedVideoAdListener

    ReplyDelete
    Replies
    1. Hi, Bruno Araujo. Can you provide here some details:
      1. React native and admob version from package.json
      2. A piece of code of Admob which apply in file.

      Thanks :-)

      Delete
  2. hi
    after this react-native link react-native-admob command the app is getting crushed please help

    ReplyDelete
    Replies
    1. Hi, any error seen while running react native app?
      you can uninstall app from mobile then re-run react native app. May be it takes cache sometimes.

      Thanks.

      Delete
    2. I found a solution on that at stactoverflow
      on you project folder, go to
      node_modules/react-native-admob/android/build.gradle
      replace compile 'com.google.android.gms:play-services-ads:+'
      with compile 'com.google.android.gms:play-services-ads:16.0.0'

      Delete
  3. > Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

    How to fix this ?

    ReplyDelete
    Replies
    1. Modify manually so that prefer to open Android Studio then
      you will see in the android\app\build.gradle file:

      android {
      compileSdkVersion 26
      buildToolsVersion "26.0.1"

      defaultConfig {
      minSdkVersion 16
      targetSdkVersion 26
      }
      }

      dependencies {
      implementation "com.android.support:appcompat-v7:26.0.1"
      }

      Above version is 26 but update version is going 28.
      you will set manually by removing digit and replace to update version.

      Thanks.

      Delete
  4. Awesome post. You Post is very informative. Thanks for Sharing.
    Android Training in Noida

    ReplyDelete
  5. i try all solutions but still i get same error : internal error, an invalid response was received from ad server

    ReplyDelete
    Replies
    1. Hello, I want to know that you are using banner test id or newly created banner ad id?

      Delete
    2. i used my new created app
      id

      Delete
    3. ok. you have to wait at least for 1-2 days. It will take some time to fetch real ads from google server.
      or Try with test id banner, if its working fine then no code issues there.

      Delete
    4. Thank you its work with simple unit id

      Delete
  6. HireFullStackDeveloperIndia is a top mobile app development company in India that is specializing in app development for iOS & Android. They trust their own expert's knowledge to give excellent mobile app solutions as they have been building mobile apps.

    See Also: Website Design Cost in India

    ReplyDelete
  7. Your blog is great. I read a lot of interesting things from it. Thank you very much for sharing. Hope you will update more news in the future.

    Freelance react native services

    ReplyDelete
  8. Hi,

    Thanks for sharing such useful blog. Really! This Blog is very informative for us which contain lot of information about React Native.

    Best Regrads - VigneshWaran P (Mobile App Development Company)

    ReplyDelete
  9. Thank a lot for this post that was very interesting. Keep posting like those amazing posts, this is really awesome :) Thank you for sharing wonderful information with us to get some idea about that content.
    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore

    ReplyDelete
  10. It was a helpful blog. Here you have clearly explained about React Native Admob Banner Error and its Solutions. It is very much helpful for the developers to create a Error Free code. If you have questions regarding React Native reach out Way2Smile Solutions Website Development Company in Chennai

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Create React Native App with Admob for Android

Passing Data Between Screens in React Native