可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.
回答1:
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...
回答2:
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.
回答3:
Eclipse project properties->Java build path->Order and export
Un-check Android private libraries.
回答4:
You have imported google-play-services and used as library. you've also added google-play-services external jar files. So ambiguity. Do not use google-play-services as library.
回答5:
I encountered this problem after adding google-play-services, but it was on a project that was not using the sdk for AdMob. After doing a clean rebuild, I stopped receiving this error. So if you are experiencing this, but are not using AdMob or still cannot figure it out for whatever reason, try doing a project clean rebuild. That is what worked for me.
回答6:
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
回答7:
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!
回答8:
select project
Rigth click on project--> Build Path --> Configure Build path--> Select libraries-->uncheck googleplaylib, and clean.
and run, i hope it will work,
I can solve my problem using this method. Try
回答9:
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] .
回答10:
Go to Eclipse, Project -> Build ALL
Fixed the problem for me. I do not have Admob lib added, but got that issue. Cleaning build and BUILDING ALL fixed it for me.
回答11:
In my case the problem occured when i moved to firebase.
The problem dissappeared when removing old "GoogleAdMobAdsSdk" sdk from "app\libs" folder.