sunnycupertino / cordova-plugin-admob-simple

Cordova plugin allowing Admob interstitials and banner ads.
MIT License
164 stars 150 forks source link

Build fails on build.phonegap.com #6

Closed stillatmylinux closed 8 years ago

stillatmylinux commented 8 years ago

I'm using

<gap:plugin name="cordova-plugin-admob-simple" source="npm" />

in the config.xml file and the build fails when that line is there, but the build works when I remove it.

I also tried it specifying the version:

<gap:plugin name="cordova-plugin-admob-simple" source="npm" spec="3.0.4" />

sunnycupertino commented 8 years ago

What platforms are you building for?

stillatmylinux commented 8 years ago

Android and iOS

sunnycupertino commented 8 years ago

You should use

<plugin name="cordova-plugin-admob-simple"           source="npm" />

Also make sure you have

<preference name="android-build-tool" value="gradle" />

If that doesn't work let me know the error it throws. Also I can upload a sample app.

stillatmylinux commented 8 years ago

Here is the error from the phonegap build log:

:preDexDebug :dexDebug UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpz; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106)

FAILED

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 1 mins 21.991 secs

/project/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /project/gradlew with args: cdvBuildDebug,-b,/project/build.gradle,-Dorg.gradle.daemon=true,-PcdvBuildMultipleApks=false

sunnycupertino commented 8 years ago

This looks more like a problem with the phonegap build tool or your configuration. The reason is probably because our plugin needs the google play services (and includes it, as it should) , and so does another plugin you use or you have included the jar file somewhere. Then their implementation of gradle tries to include it twice instead of stripping out one of them.

See http://stackoverflow.com/questions/31224276/multiple-dex-files-define-lcom-google-android-gms-internal-zzau

Try contact phonegap about it.

Check what other plugins you use, and check their plugin.xml files.

You can see where we reference it here https://github.com/sunnycupertino/cordova-admob-sdklibs/blob/master/plugin.xml

stillatmylinux commented 8 years ago

You are correct.

<!--<gap:plugin name="pushwoosh-pgb-plugin" source="npm" spec="5.0.3" />-->

The PushWoosh plugin requires gradle too and commenting it out allow me to include:

<gap:plugin name="cordova-plugin-admob-simple" source="npm" spec="3.0.4" />

and it builds fine.

sunnycupertino commented 8 years ago

Ok can I close this issue?

stillatmylinux commented 8 years ago

yes