Conversion to Dalvik format failed: Unable to execute dex SDK Tools 22.3

后端 未结 7 1576
刺人心
刺人心 2021-02-13 19:30

Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode

Latest ADT, Latest SDK Tools (22.3).

I Tried :

  1. Clean/rebuild
  2. Update Eclipse
相关标签:
7条回答
  • 2021-02-13 19:58

    Have you checked your xml files? I have the same Problem (and it is not solved yet) and I forgot to change the adView attribute from:

    <com.google.ads.AdView
        android:id="@+id/adView"
    

    to

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
    

    then you should also chech your

    xmlns:ads="http://schemas.android.com/apk/lib/com.google.android.gms.ads"
    

    (dunno if this is right though...)

    Edit: Found this:

        <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:ads="http://schemas.android.com/apk/res-auto"
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent">
      <com.google.android.gms.ads.AdView android:id="@+id/adView"
                             android:layout_width="wrap_content"
                             android:layout_height="wrap_content"
                             ads:adUnitId="MY_AD_UNIT_ID"
                             ads:adSize="BANNER"/>
    </LinearLayout>
    

    (Source: https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals)

    Edit2:

    Ok now I solved my Problem. I am such an Idiot... Well I integrated the AdMob SDK in the services library... I deleted it and everything was great again! So delete the services_lib, download it and import again that should work I guess. Good Luck!

    0 讨论(0)
  • 2021-02-13 19:59

    *Right click on project name and select the Build Path.

    *Then select Configure Build Path.

    *From Java Build Path select the tab Order and Export.

    *Uncheck the .jar libraries.

    The error is generally due to multiplicity in libraries.

    0 讨论(0)
  • 2021-02-13 20:00

    Eclipse project properties->Java build path->Order and export

    Uncheck Android private libraries.

    Do not use jar file and library project together of google play service lib in your project.

    0 讨论(0)
  • 2021-02-13 20:05

    Worked fine after delete the "GoogleAdMobAdsSdk-6.4.1.jar" from my project. Dont forget to add the Google Play Services as Library to your app. Regards!

    0 讨论(0)
  • 2021-02-13 20:09

    It's because Google Play Service has google Ads in it. That's why you're having multiple dex error.

    http://developer.android.com/reference/com/google/android/gms/ads/AdRequest.html

    0 讨论(0)
  • 2021-02-13 20:11

    If you are using google play service as well, then there is a conflict.

    0 讨论(0)
提交回复
热议问题