Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Admob in Android App - Multiple dex files define

Tags:

android

admob

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

like image 343
user2977422 Avatar asked Nov 25 '13 17:11

user2977422


1 Answers

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;
like image 187
William Avatar answered Nov 14 '22 22:11

William