chemerisuk / cordova-support-google-services

DEPRECATED. Cordova plugin to add google services support
MIT License
41 stars 107 forks source link

Remove "apply plugin: com.google.gms.googleservices.GoogleServicesPlugin" #4

Closed JosefJezek closed 5 years ago

JosefJezek commented 6 years ago

I have this issue by compiling...

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
   > For input string: "+"

The solution in FAQ is not functioning for me.

Info about "apply plugin: com.google.gms.googleservices.GoogleServicesPlugin" https://github.com/dpa99c/cordova-plugin-request-location-accuracy/issues/35#issuecomment-325690966

Another fix https://github.com/dpa99c/cordova-plugin-fcm/commit/4940f835058313d149ede23f3d8a78a25df00036

I am using this plugin for play services now... https://github.com/dpa99c/cordova-android-play-services-gradle-release

lsantaniello commented 6 years ago

Hi, I have the same problem but I don't understand how solve it. Could you please help me?

JosefJezek commented 6 years ago

@lsantaniello Use my fork and cordova-android-play-services-gradle-release

https://github.com/StartPolymer/cordova-plugin-firebase-dynamiclinks

The-Don-Himself commented 6 years ago

This is a breaking issue and hard to work-around on Phonegap build, trying @JosefJezek fix and will report back.

jamminjames commented 6 years ago

@JosefJezek How can I use your solution in an app built with PhoneGap Build? I tried adding cordova-android-play-services-gradle-release and ordova-plugin-firebase-dynamiclinks via NPM in config.xml, but that's not working.

The-Don-Himself commented 6 years ago

Yes, I meant to confirm that @JosefJezek fork solution works, on phonegap build as well. @jamminjames you'll have to be more specific, what doesn't work on PGB? The build doesn't build or the app doesn't work, not building is easier to debug, not working a bit less than so.

jamminjames commented 6 years ago

It won't build, and I get the "Error: more than one library with package name 'com.google.android.gms'" error, which is why I was trying cordova-support-google-services in the first place. When I just use that, I get the "Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']" error.

The-Don-Himself commented 6 years ago

Great, then it just some plugins conflicts going on somewhere, most likely a small change in config.xml will solve it, for reference, here is a snippet of mine that I've successfully build with.

    <plugin name="cordova-plugin-dialogs" spec="^1.3.4" />
    <plugin name="cordova-plugin-globalization" spec="^1.1.0" />
    <plugin name="cordova-plugin-inappbrowser" spec="^1.7.2" />
    <plugin name="cordova-plugin-accountkit" spec="^1.4.0">
        <variable name="APP_ID" value="123456789" />
        <variable name="APP_NAME" value="My App" />
        <variable name="CLIENT_TOKEN" value="123456789ABCXYZ" />
        <variable name="API_VERSION" value="v1.3" />
    </plugin>
    <plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
    <plugin name="cordova-plugin-apprate" spec="^1.3.0" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <preference name="SplashMaintainAspectRatio" value="true" />
    <preference name="FadeSplashScreenDuration" value="300" />
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <preference name="SplashScreenDelay" value="3000" />
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-contacts" spec="^3.0.1" />
    <plugin spec="https://username:password@bitbucket.org/my-project/cordova-plugin-firebase" source="git" />
    <plugin name="cordova-plugin-x-socialsharing" spec="^5.3.2" />
    <plugin name="cordova-plugin-geolocation" spec="^4.0.1">
        <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Geo-location helps us show you nearby businesses and their relevant discounts to you based on your current location." />
    </plugin>
    <plugin name="cordova-plugin-mauron85-background-geolocation" spec="^3.0.0-alpha.24">
        <variable name="ALWAYS_USAGE_DESCRIPTION" value="Geo-location helps us show you nearby businesses and their relevant discounts to you based on your current location." />
        <variable name="MOTION_USAGE_DESCRIPTION" value="Geo-location helps us show you nearby businesses and their relevant discounts to you based on your current location." />
        <variable name="ICON" value="@mipmap/icon" />
        <variable name="SMALL_ICON" value="@mipmap/icon" />
        <variable name="ACCOUNT_NAME" value="@string/app_name" />
        <variable name="ACCOUNT_LABEL" value="@string/app_name" />
        <variable name="ACCOUNT_TYPE" value="$PACKAGE_NAME.account" />
        <variable name="CONTENT_AUTHORITY" value="$PACKAGE_NAME" />
    </plugin>
    <plugin name="cordova-sms-plugin" spec="^0.1.11" />
    <plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.3" />
    <plugin spec="https://github.com/StartPolymer/cordova-plugin-firebase-dynamiclinks" source="git">
        <variable name="APP_DOMAIN" value="a123.app.goo.gl" />
        <variable name="APP_PATH" value="/" />
        <variable name="FIREBASE_VERSION" value="+" />
    </plugin>
    <plugin name="cordova-android-play-services-gradle-release" spec="^1.3.1" />
kashban commented 6 years ago

Same issue here. The cause "+" is within the build.gradle of cordova-support-google-services:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:3.2.0'
    }
}

// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
ext.postBuildExtras = {
    apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
}

We don't have this kind of generic version anywhere else in our project.

chemerisuk commented 5 years ago

https://github.com/chemerisuk/cordova-support-google-services#build-error-failed-to-apply-plugin-class-comgooglegmsgoogleservicesgoogleservicesplugin