java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:


 just give a check meta-data tag is out of activity tag

if it is like this

<manifest>
    <application>
        <activity>
            <meta-data> 
                android:name="com.google.android.gms.ads.APPLICATION_ID" 
                android:value="ca-app-pub-4347201915048498~6120388314"/>
        </activity>
    </application>
</manifest>

this should be changed to this

<manifest>
    <application>
        <activity>
        </activity>
        <meta-data 
            android:name="com.google.android.gms.ads.APPLICATION_ID" 
            android:value="ca-app-pub-4347201915048498~6120388314"/>
    </application>
</manifest>


                                   OR

Only add this code to the manifest on your app and thats it

<meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true"/>


                                         OR

Note:- Make sure you don't have your meta-data tag inside activity...been there, done that.



<application>
   ...
   ...
   < meta-data 
        android:name="com.google.android.gms.ads.APPLICATION_ID" 
        android:value="ca-app-pub-################~##########"/> 
</application>

The solution is to put the meta data lines at Last (means below all other meta-data present in your android manifest file but just before closing application tag).


Don't get confused with APPLICATION_ID. You should not replace it with your application ID for ex. com.example.myapp. Just keep it as it is.

<application>
...
      <meta-data 
           android:name="com.google.android.gms.ads.APPLICATION_ID" 
           android:value="ca-app-pub-################~##########"/>
...
</application>

Comments

Popular posts from this blog

How to authenticate mobile number in android studio

How to connect android project to Firebase

How to create android project in android studio

How to add Video(Part-1) in FirebaseRecyclerAdapter from Galllary..

How to add(Part-2) Video in FirebaseRecyclerAdapter in android studio

How to create a new java class in android studio

How to create a new activity in existing android project in android studio

How to Add Like,Dislike button in video in android studio

How to Create a Custom menu in android studio

How to create Layout Resource File in existing project in android studio