Multiple dex files define Lcom/google/ads/AdReques

2019-01-19 11:05发布

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.

enter image description here

11条回答
放我归山
2楼-- · 2019-01-19 11:16

In my case the problem occured when i moved to firebase.

The problem dissappeared when removing old "GoogleAdMobAdsSdk" sdk from "app\libs" folder.

查看更多
孤傲高冷的网名
3楼-- · 2019-01-19 11:22

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:

dependencies {
  ...
  compile 'com.google.android.gms:play-services:5.0.89'
  ...
}

So I deleted the google-play-services.jar from the libs folder and the app was working fine again

查看更多
Deceive 欺骗
4楼-- · 2019-01-19 11:23

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.

查看更多
一夜七次
5楼-- · 2019-01-19 11:23

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] .

查看更多
淡お忘
6楼-- · 2019-01-19 11:24

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!

查看更多
Evening l夕情丶
7楼-- · 2019-01-19 11:25

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...

查看更多
登录 后发表回答