ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
495 stars 211 forks source link

cordova build android gives transformDexArchiveWithDexMergerForDebug error #154

Open fmss7 opened 6 years ago

fmss7 commented 6 years ago

I've already added cordova-plugin-admob-free to my Ionic-Cordova project but when I try ionic cordova run android build fails with this message:

1 I've tried with multiDexEnabled true and deleting node_modules and then npm install but still the same problem.

Info:

Ionic-CLI: 3.19.1
Cordova: 7.1.0
Cordova-android: 6.4.0

Any ideas?

MBuchalik commented 6 years ago

Are you using another plugin that adds Play Services to your app? In my case, it was caused by phonegap-plugin-push (version 1.10.5). To fix it, I manually added the following lines (the push plugin uses Play Services 11.x)

<plugin name="cordova-admob-sdk" source="npm" spec="0.13.1">
    <variable name="PLAY_SERVICES_VERSION" value="11+" />
</plugin>
fmss7 commented 6 years ago

Yes, I'm using cordova-plugin-firebase v0.1.25 in my project

MBuchalik commented 6 years ago

Well then I'd suggest trying to find out the version of Play Services that are used in cordova-plugin-firebase. Then, you could try to use the approach mentioned above. I am not sure if it will work, but in my case, I was able fix the problem (with phonegap-plugin-push).

fmss7 commented 6 years ago

Thanx @MBuchalik!

steinjonathan commented 6 years ago

I'm still having this same problem. I added this code that you mentioned @MBuchalik to de config.xml, but for me it doesn't work.

My error output:

* What went wrong:
Execution failed for task ':transformDexArchiveWithDexMergerForDebug'.
com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzev;

My ionic info

ionic (Ionic CLI) : 3.19.0 cordova (Cordova CLI) : 7.1.0 android 6.4.0

Do you have an idea to help me?

steinjonathan commented 6 years ago

Install the old version solved my problem! https://github.com/ratson/cordova-plugin-admob-free/issues/141

MBuchalik commented 6 years ago

@steinjonathan I assume that you don't want to use an older version of the plugin forever 😄. If so: Have a look at the list of plugins you have installed. One if them is probably using the Play Services. If you find the plugin, you can (maybe - I am not using Ionic) use a similar approach like the one I posted above. In order to find the plugin, you can simply remove a few and try to compile. If it doesn't work, remove some other plugins. And so on...

tominou commented 6 years ago

Can you show me your platform/android/project.properties

Taz008 commented 5 years ago

Hey Guys, follow these steps, it worked for me: Go to: Platforms->Android->build.gradle defualtConfig { multidexEnabled true } This sol works for me. Hope it helps!

Cheers!