Android Question Admob error - but not in B4A code?

mistermentality

Active Member
Licensed User
Longtime User
I've got everything set up for the new admob service using B4A 3.20, admob upgraded online, newest admob library and google play services and new code added in manifest plus new attribute iadded in project attributes section of B4A code but now the app will not compile.

It times out. I click yes or no to cancel or continue compilation and get the same error every time.

The only new line of code I have added is as follows

B4X:
#AdditionalRes: C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms

and of course I changed the AD ID in adview to the new Admob ID I received.

Every time I compile my app, it times out and always shows the following:

B4X:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$ErrorCode;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
    at com.android.dx.command.dexer.Main.processClass(Main.java:490)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
    at com.android.dx.command.dexer.Main.access$400(Main.java:67)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
    at com.android.dx.command.dexer.Main.processOne(Main.java:422)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
    at com.android.dx.command.dexer.Main.run(Main.java:209)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
    Optimized dexer failed. Switching to Standard dexer.

The code I added is fine, no other code is changed and yet the line "already added: Lcom/google/ads/AdRequest$ErrorCode;" seems to be a big clue, it suggests that during compilation the compiler is adding something that is already there (?) but what?

I have checked my code over and over now for well over six hours and this is really frustrating as I can find nothing I've done, at least not in code, that could cause this, can any one help me with some advice please. Or at least help me understand what the error message means?

Thanks.

Dave
 

mistermentality

Active Member
Licensed User
Longtime User
I am using Admob version 2.0, Audio version 1.55, Core version 3.21, custom toast version 1.1, GoogleAdMobsAdsSdk version 1.0, ML Files version 1.45 and reflection version 2.4.

I have copied play services library to B4A libraries folder but that doesn't show up, should it show up and be ticked in B4A?

Thanks.

Dave
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
I am using Admob version 2.0, Audio version 1.55, Core version 3.21, custom toast version 1.1, GoogleAdMobsAdsSdk version 1.0, ML Files version 1.45 and reflection version 2.4.

I have copied play services library to B4A libraries folder but that doesn't show up, should it show up and be ticked in B4A?

Thanks.

Dave

Thanks to your pointer about libraries I unticked the GoogleaAdmobsSdk library and it compiles fine. Thanks.

Dave
 
Upvote 0
Top