I created android application and try to add admob to it. but it not works. can anyone help me to fix this error.
[2014-04-09 15:16:51 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
[2014-04-09 15:16:51 - Aurudhu_App] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
This is the application architecture.
In my case the problem occured when i moved to firebase.
The problem dissappeared when removing old "GoogleAdMobAdsSdk" sdk from "app\libs" folder.
I had this problem because I had the google-play-services.jar in my libs folder, while including the play services in build.gradle like this:
So I deleted the google-play-services.jar from the libs folder and the app was working fine again
I had this error.
Make sure google-play-service.jar is not added twice (even in different modules...as in my case). It takes long time to debug those bugs.
Remove google play service plugin by writing cordova plugin remove com.google.playservices and add the cordova admob plugin by writing cordova plugin add [your admob plugin name] .
I had this problem, and this problem too:
java.lang.NoClassDefFoundError: com.google.ads.AdView
Despite many hours of following all solutions listed the only way I could get my app to work was to use the
AdMob banner
example here.And re-build my project around it, copying my files in to that project. If you are stuck, try it.
Don't know why it worked, but now it does. Something in my project was very wrong. Now I can carry on with my work. I love
Google/Android
, but really what a mess!google-pay-services.jar and GoogleAdMobAdsSdk.jar having same class name for AdMob. May be due to that reason you are getting multiple .dex files.
Please follow the docs steps of this sample code link of AdMob by using google-pay-services.jar instead of GoogleAdMobAdsSdk.jar.
Hope it will help you, Still you have any problem then let me know...