user2798381
user2798381

Reputation: 21

Admob click -> App crashes and nothing happens

i implemented two Admob Ads in two XML Layouts. They are loading and showing but when i click on the ads, my app crashes (maybe because my onPause method includes System.exit(0); , Otherwise it crashed on Resume.

But the click on the admob ad doesn't start anything else. I'm not getting redirected to the market or to the browser.

I click on it, my app finishes and nothing else happens.

Any ideas? I followed the google developers guide for implementing, this is the code inside my app:

AdView adView = (AdView)this.findViewById(R.id.adView2);
    AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);

Solved

The problem was like I thought the onPause Method which killed all java instances of my app, thats why the app crashed immediately and the ad wouldn't work. By fixing my problems with the onPause and on Resume Methods, I fixed the problems mentioned above.

Upvotes: 0

Views: 490

Answers (1)

Ashok Varma
Ashok Varma

Reputation: 3539

Try removing System.exit(0);

Can you be more specific about error, connect phone though adb monitor error and post it.Check most common errors below

1) have you added the activity in manifest file ??, If not add this in manifest

<activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

2) meta data to your application

<meta-data android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

3) I think you added these permissions because without these ads won't pop up, but since you said you got the ads, this might not be your case

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Check here for more details :- https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start

Upvotes: 1

Related Questions