Android Question Error compile after use new AdMob

Discussion in 'Android Questions' started by susu, Aug 6, 2015.

  1. susu

    susu Well-Known Member Licensed User

    Hi, I recently update my app with new AdMob. I follow all steps in tutorial:
    - Update Google Play Service then add google play jar file to Additional Libs Folder.
    - Update AdMob lib to 2.0.
    - Add #AdditionalRes: D:\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
    - Add AddApplicationText( ........ ) in menifest.
    - Change AdMob ID to the new one "ca-app-pub-XXXXXXXXXXXXXXX".
    - Path configuration:
    Javac.exe C:\Program Files (x86)\Java\jdk1.8.0_25\bin\javac.exe
    Android.jar D:\android-sdk\platforms\android-19\android.jar
    - I'm using B4A 5.02(1) on Windows 10.

    The error is:
    Code:
    Convert byte code - optimized dex.    Error
    UNEXPECTED TOP-LEVEL 
    EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;
        at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:
    122)
        at com.android.dx.dex.file.DexFile.add(DexFile.java:
    161)
        at com.android.dx.command.dexer.Main.processClass(Main.java:
    685)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:
    634)
        at com.android.dx.command.dexer.Main.access$
    600(Main.java:78)
        at com.android.dx.command.dexer.Main$
    1.processFileBytes(Main.java:572)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:
    284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:
    144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:
    596)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:
    498)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:
    264)
        at com.android.dx.command.dexer.Main.run(Main.java:
    230)
        at com.android.dx.command.dexer.Main.main(Main.java:
    199)
        at com.android.dx.command.Main.main(Main.java:
    103)
    1 error; aborting
    I try to Clean Project but no luck too.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Based on the error message you are referencing another library other than AdMob that includes AdMob classes.
     
  3. susu

    susu Well-Known Member Licensed User

    Can I know which library that includes AdMob classes?

    libs.jpg
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I'm not familiar with all this library. Create a new project and add the libraries. Now uncheck the libraries until the error is resolved.

    It is probably mwAdmobInterstital.
     
    susu likes this.
  5. susu

    susu Well-Known Member Licensed User

    If the problem is mwAdmobInterstital, how can I use both of them? Or my question will be "Will you add Interstitial ads support to AdMob library" ?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You can delete the duplicate classes from the jar file (open it with 7zip).
     
    susu likes this.
  7. susu

    susu Well-Known Member Licensed User

    I disable mwAdmobInterstital and I can compile but when I open my app there's another error like screenshot.
    I'm using Google Play Service Rev 25 and AdMob v2.0.

    Screenshot_2015-08-06-20-58-05.jpg
     
  8. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice