5
votes

I follow the tutotial for addding interstitial Ad to Android App

https://developers.google.com/mobile-ads-sdk/docs/admob/advanced

I already imported the google-play-services_lib but the compiler complain AdListener is missing.

So I put the GoogleAdMobAdsSdk jar into lib folder The error of missing class gone.

But during compiling, there is an error Unable to execute dex: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;

Seems can't having both GoogleAdMobAdsSdk and google-play-services_lib together

Anyone can help me ?

thanks in advance

2

2 Answers

5
votes

Don't include both libraries, only include Google Play Services.

Make sure that your import for the AdListener is

import com.google.android.gms.ads.AdListener;

and not

import com.google.ads.AdListener;
2
votes

This is one worked for me: remove GoogleAdMobAdsSdk.jar from Project/Properties/Java Build Path/Libraries, and from libs folder of your project.

You shouldn't import jar, but the hole project implementing AdMob functionaluty. check the guide here https://developers.google.com/mobile-ads-sdk/docs/