Closed stillatmylinux closed 8 years ago
What platforms are you building for?
Android and iOS
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.
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.
What went wrong: Execution failed for task ':dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command: /android-sdk/build-tools/23.0.1/dx --dex --no-optimize --output /project/build/intermediates/dex/debug --input-list=/project/build/intermediates/tmp/dex/debug/inputList.txt Error Code: 2 Output:
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)
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
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.
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
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.
Ok can I close this issue?
yes
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" />