Cannot build google iap v3 and admob plugins on android - multidex error

Hi,

I am trying to build my app on android but it fails during the dex stage. I use the following libraries in my ./App/android/libs directory:

-rw-r–r--@ 1 User  staff    14237 May  2  2014 CoronaProvider.ads.admob.jar

-rw-r–r--@ 1 User  staff    88726 Jul 15  2014 classes.jar

-rw-r–r--@ 1 User  staff  1501528 May  2  2014 google-play-services.jar

-rw-r–r--@ 1 User  staff    59392 Nov  7 18:05 plugin.google.iap.v3.jar

I got the CoronaProvider.ads.admob.jar from the CoronaEnterprisePlugins/ads-admob

I got google-play-services.jar and classes.jar from the CoronaEnterprisePlugins/google-play-services

I got the plugin.google.iap.v3.jar from the CoronaEnterprisePlugins/google-iap-v3

Converting compiled files and external libraries into /Users/Rebekah/Alan/spacewolf/code/mobile/apps/PhotoDeco/Original/corona/v2.0/projects/enterprise/android/bin/classes.dex... [dx] Merged dex A (16 defs/8.4KiB) with dex B (69 defs/68.1KiB). Result is 85 defs/89.5KiB. Took 0.1s [dx] Merged dex A (85 defs/89.5KiB) with dex B (13 defs/47.9KiB). Result is 98 defs/166.1KiB. Took 0.1s [dx] Merged dex A (98 defs/166.1KiB) with dex B (40 defs/57.4KiB). Result is 138 defs/281.7KiB. Took 0.1s [dx] [dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] com.android.dex.DexException: Multiple dex files define LCoronaProvider/ads/admob/AdMobAd$1; [dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) [dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) [dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) [dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) [dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) [dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) [dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) [dx] at com.android.dx.command.dexer.Main.run(Main.java:246) [dx] at com.android.dx.command.dexer.Main.main(Main.java:215) [dx] at com.android.dx.command.Main.main(Main.java:106) [dx] 

I tried using all the libraries from the CoronaEnterprisePlugins/ads-admob and it correctly compiles, but then the method ads.isLoaded method in my lua code fails because ads.isLoaded is nil.

Can anybody help me out? How can I get these two plugins to play nice together?

Thanks in advance.

So here is the answer:

CoronaEnterprisePlugins/ads-admob is the admob-v1 plugin. Don’t use it if you want v2! Which means don’t include any library files from that directory. Only use the library files from CoronaEnterprisePlugins/google-play-services. This contains the admob-v2 library. I wish there was a little better documentation on this. Also the CoronaEnterprisePlugins/google-play-services contains a library called classes.jar. Corona should rename this file to something a little more descriptive right? This type of filename could easily clash with other filenames and then you would be hosed.

So here is the answer:

CoronaEnterprisePlugins/ads-admob is the admob-v1 plugin. Don’t use it if you want v2! Which means don’t include any library files from that directory. Only use the library files from CoronaEnterprisePlugins/google-play-services. This contains the admob-v2 library. I wish there was a little better documentation on this. Also the CoronaEnterprisePlugins/google-play-services contains a library called classes.jar. Corona should rename this file to something a little more descriptive right? This type of filename could easily clash with other filenames and then you would be hosed.