Android Application Getting Crashed Just After Launch on AdMob Ad Integration

After integration of AdMob  ad into you application, if application is getting closed immediately after launch with message "Unfortunately Application  has stopped". Find the error log in Log Cat like below


02-23 12:47:23.763: E/AndroidRuntime(9862): FATAL EXCEPTION: main
02-23 12:47:23.763: E/AndroidRuntime(9862): Process: jaiib.quiz, PID: 9862
02-23 12:47:23.763: E/AndroidRuntime(9862): java.lang.RuntimeException: Unable to start activity ComponentInfo{jaiib.quiz/jaiib.quiz.MainActivity}: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2187)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.app.ActivityThread.access$800(ActivityThread.java:138)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.os.Handler.dispatchMessage(Handler.java:102)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.os.Looper.loop(Looper.java:136)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at android.app.ActivityThread.main(ActivityThread.java:5095)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at java.lang.reflect.Method.invokeNative(Native Method)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at java.lang.reflect.Method.invoke(Method.java:515)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-23 12:47:23.763: E/AndroidRuntime(9862):  at dalvik.system.NativeStart.main(Native Method)
02-23 12:47:23.763: E/AndroidRuntime(9862): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />





Solution -
If such error comes then through error log only, it is clear that required meta-data tag in app's AndroidManifest.xml does not exist. So just add below lines in AndroidManifest.xml file inside application block and try to run.

<!--This meta-data tag is required to use Google Play Services.-->
        <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

Comments