EddyVerbruggen / cordova-plugin-googleplus

:heavy_plus_sign: Cordova plugin to login with Google Sign-In on iOS and Android
567 stars 629 forks source link

Remove "Dependency" tags to avoid Multiple Dex Error #114

Open muditjaju opened 9 years ago

muditjaju commented 9 years ago

Hello,

Since we are using so many different plugins adding playservices as dependencies causes the system to show the Multiple Dex error when building the android project

We should replace this with the framework src="com.google.android.gms:play-services-plus:+" / framework src="com.google.android.gms:play-services-identity:+" / To avoid the multiple dex errors :)

EddyVerbruggen commented 9 years ago

I understand, but those tags only work with newer Cordova version and are known to clash with users using PhoneGap Build and older Cordova versions. That's why I'm currently a little reluctant to do this..

muditjaju commented 9 years ago

Hmm .. agree with that .. btw thanks a lot for this great plugin and lets just leave this post here just in case someone bumps into the Multiple Dex problem :)

EddyVerbruggen commented 9 years ago

Great idea and thanks! :+1:

frankps commented 9 years ago

Hey there,

Thanks for this great component !! It works perfectly in an isolated project, but once we add push functionality it won't compile anymore. -> it is giving the Dex errors mentioned above:

  com.android.dex.DexException: Multiple dex files define         Lcom/google/android/gms/actions/ReserveIntents;

We're using Cordova 5.1.1 in Visual Studio. We tried to configure:

<framework src="com.google.android.gms:play-services-identity:+" />

in the plugin.xml file. But we keep getting the Dex errors.

Does anybody have an idea what we can try?

Thanks very much! /Frank

muditjaju commented 9 years ago

Hello frankps

Did you remove and add the plugin again after making the changes ? Directly changing the code will not work.

If you are using framework src then the Multiple Dex Error will not come

Follow these steps:

frankps commented 9 years ago

Hey muditjaju, Thanks so much: we followed your procedure and it is working now! /frank

muditjaju commented 9 years ago

No problem Frank. Been there done that :) Happy to help

aaronfranco commented 9 years ago

You have installed this plugin and are getting the multiple Dex files error. Here are the correct steps to remove the error.

Step 1: Check for installed plugins via terminal

> cordova plugin

You will see this:

...
cordova-plugin-googleplus
cordova-plugin-googleplayservices
...

This GooglePlus plugin will have installed the GooglePlayServices plugin as a dependency. Both the plugins must be removed manually. Although this GooglePlus plugin adds the dependency automatically, it does not remove it automatically.

Step 2: Remove the plugins via terminal

> cordova plugin rm cordova-plugin-googleplus
> cordova plugin rm cordova-plugin-googleplayservices

Step 3: Following the above guide, clone this repository, and modify the plugin.xml file Android "platform" tag contents to the following.

<platform name="android">

    <!-- these give a lot of peeps trouble, esp on build.phonegap.com, so not using them -->
    <framework src="com.google.android.gms:play-services-plus:+" />
    <framework src="com.google.android.gms:play-services-identity:+" />
    <!-- <dependency id="cordova-plugin-googleplayservices" /> -->

    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="GooglePlus">
        <param name="android-package" value="nl.xservices.plugins.GooglePlus" />
        <param name="onload" value="true" />
      </feature>
      <access origin="https://accounts.google.com/*" />
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.GET_ACCOUNTS" />
      <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    </config-file>

    <source-file src="src/android/GooglePlus.java" target-dir="src/nl/xservices/plugins"/>
  </platform>

You can see that we are removing the dependency to that googleplayservices plugin.

I cloned this plugin directly into the root folder of my Cordova project so the path to the plugin for me is "./cordova-plugin-googleplus" Yours might be different. Now add the plugin from the file system making sure to modify the REVERSED_CLIENT_ID variable to your own Google App Client_ID.

cordova plugin add ./cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=xyz

Now your app should build properly.

neosekar commented 8 years ago

Thx for the support . After i removed the line of code as u mentioned in build.gradle of firebase plugin . Once i build i got this error, platforms\android\res\values\strings.xml: Error: Found item String/google_app_id more than one time :mergeArmv7DebugResources FAILED