2

I am trying to use PhoneGap-Push-Plugin as well as Cordova-plugin-request-location-accuracy. But while building apk on PhoneGap build I am getting an error.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/zzc;

What I tried.

<plugin name="phonegap-plugin-push" source="npm" spec="1.8.4">
<plugin name="cordova-plugin-request-location-accuracy" spec="*" />

If I install any single plugin from above two.its working. But when I m trying to install both the plugins. I am getting an error.

I am not getting why conflict is happening while using those two plugins.

Maheshvirus
  • 6,749
  • 2
  • 38
  • 40

1 Answers1

0

cordova-plugin-request-location-accuracy@* currently references Play Services library v11.+ as a dependency and phonegap-plugin-push@1.8.4 references Play Services v9.8 so this is the likely cause of your build error since two different library versions are referenced.

You can use cordova-android-play-services-gradle-release to override the versions specified by these plugins in order to align them, for example:

cordova plugin add cordova-android-play-services-gradle-release --variable PLAY_SERVICES_VERSION=9.8

This will override the version specified by cordova-plugin-request-location-accuracy@* in order to align it with phonegap-plugin-push@1.8.4.

DaveAlden
  • 30,083
  • 11
  • 93
  • 155
  • Hello @DaveAlden Thanks for your answer but its still not working.I am using other plugins in my code.if i tried with only location accuracy and phonegap push plugin then its working. but i want to install other plugins as well. – Maheshvirus May 16 '18 at 10:20
  • this is the error code * What went wrong: Execution failed for task ':processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt – Maheshvirus May 16 '18 at 10:20
  • That error message alone is meaningless. If you don't specify what the other plugins are, or at least the ones that are problematic, then no-one here can provide an answer for you. I suggest first adding the 2 plugins you have mentioned in your question title to your project, then adding each additional plugin until the build fails to determine which plugins are problematic, then update your question to list them. Or just list all the plugins you are using. – DaveAlden May 16 '18 at 11:00
  • You are right but the thing is before using Gradle release plugins. I was facing conflict issue for only location accuracy and PhoneGap push plugins. But when i installed Gradle release plugins then even i m not able to install camera, device, statusbar etc.but if i remove all other plugins then apk build successfully only with location accuracy and phonegap push plugins. Either i have to install these two(accuracy & Push) plugins or rest of the plugins. – Maheshvirus May 17 '18 at 10:02
  • I am also facing the same issue, is this issue fixed for you? If Yes could you please suggest what you did. – ur truly friend May 29 '18 at 09:54
  • I raised a new question. Can you look on that? https://stackoverflow.com/questions/50571708/cordova-location-accuracy-plugin-causing-build-fail – ur truly friend May 29 '18 at 12:29
  • @ur-truly-friend -till not fixed bro. – Maheshvirus Jun 02 '18 at 08:26