Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to apply plugin [id 'com.google.gms.google-services'] Plugin with id 'com.google.gms.google-services' not found. #2

Closed
prashant-musale opened this issue Aug 10, 2015 · 18 comments

Comments

@prashant-musale
Copy link

I am getting above error after adding plugin using cordova plugin add cordova-plugin-gcmpushplugin

@gonzaloaune
Copy link
Owner

Please refer to this guide to setup the Gradle configuration: https://developers.google.com/cloud-messaging/android/client

//Add the dependency to your project's top-level build.gradle:
classpath 'com.google.gms:google-services:1.3.0-beta1'

//Add the plugin to your app-level build.gradle:
apply plugin: 'com.google.gms.google-services'

//Set Up Google Play Services
dependencies {
  compile "com.google.android.gms:play-services:7.5.+"
}

I will add it to the README as well, it seems the gradle extra file I added doesn't really work right now, I will investigate further and update.

@prashant-musale
Copy link
Author

Now its working after adding dependencies to top level gradle file.
I have one more doubt. Where to write code that will execute when i click on notification?
And is there any option for displaying multiple notifications. Currently only one notification getting displayed on lock screen even though multiple notifications fired.

@gonzaloaune
Copy link
Owner

Hi,

sorry for the long wait, my responses for your doubts are:

  1. Where to write code that will execute when you click on notifications?, that's easy, it's in the README file! you should check the response for the onNotification method you should declare, check here: https://github.com/gonzaloaune/GCMPushPlugin#usage

  2. Displaying multiple notifications?, right now I made it to only show always one, but I guess it can be added in the future, feel free to send me a pull request if you think you can do that :), otherwise I will add it to the ToDo list.

Thanks!

@ezequielrozen
Copy link

Hi @gonzaloaune. Please, can you tell me explicitly in which part of the build.gradle file I have to put this lines? Or can you tell me what is the top level gradle file?

I have this error:

A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
Could not find any version that matches com.google.android.gms:play-services-gcm:7.5.+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/google/android/gms/play-services-gcm/
Required by:
:android:unspecified

Thanks!

@Vahn84
Copy link

Vahn84 commented Sep 25, 2015

i'm struggling with this from about an hour. Could you describe in a more detailed way where to put those lines of code?

@prashant-musale
Copy link
Author

Post your gradle fileSent from Yahoo Mail for iPhoneOn 25-Sep-2015, 3:56:03 PM, Vahn84 wrote:i'm struggling with this from about an hour. Could you describe in a more detailed way where to put those lines of code?

—Reply to this email directly or view it on GitHub.

@akreienbring
Copy link

Please read here for my findings:
https://github.com/akreienbring/GCMPushPlugin

@Vahn84
Copy link

Vahn84 commented Sep 25, 2015

It started building but now i got error

com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/AuthenticationToken

Gradle files interested are two

this is the one in android/CordovaLib (supposing is the app-level build.gradle)

 buildscript {
   repositories {
    mavenCentral()
    jcenter()
 }

// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
if (gradle.gradleVersion >= "2.2") {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
} else if (gradle.gradleVersion >= "2.1") {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.14.0+'
    }
} else {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.0+'
    }
}
}

 apply plugin: 'android-library'

 android {
 compileSdkVersion cdvCompileSdkVersion
 buildToolsVersion cdvBuildToolsVersion
 publishNonDefault true

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_6
    targetCompatibility JavaVersion.VERSION_1_6
}
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
}
}
 apply plugin: 'com.google.gms.google-services'
dependencies {
compile "com.google.android.gms:play-services:8.1.0"
}

AND this is the one in android root (supposing is the top level build.gradle)

 buildscript {
  repositories {
    mavenCentral()
    jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
if (gradle.gradleVersion >= "2.2") {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0+'
        classpath 'com.google.gms:google-services:1.4.0-beta3'
    }
} else if (gradle.gradleVersion >= "2.1") {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.14.0+'
        classpath 'com.google.gms:google-services:1.4.0-beta3'
    }
} else {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.0+'
        classpath 'com.google.gms:google-services:1.4.0-beta3'
    }
}
}

.....

@Vahn84
Copy link

Vahn84 commented Sep 25, 2015

Removing and adding again the android platform in cordova solved the issue!

@srameshr
Copy link

Stuck on this! If anybody has successfully configured this, then can you please update the README.md properly? Right now it is very sparse and confusing. I can't get what top level gradle file is or where to add this new classPaths.

@tonholis
Copy link

tonholis commented Mar 4, 2016

+1 Stuck on this!

@srameshr
Copy link

srameshr commented Mar 4, 2016

@tonholis
Chuck this plugin. It is not maintained anymore. Phonegap push plugin is amazingly documented and has a great support by the plugin author. Please consider using that.

@tonholis
Copy link

tonholis commented Mar 4, 2016

@srameshr Thanks! I'll check the Phonegap push plugin.

@GedMarc
Copy link

GedMarc commented Jul 13, 2016

phonegap push no longer works though, deprecated

@GedMarc
Copy link

GedMarc commented Jul 13, 2016

Add the following to plugin.xml

<framework src="build-extra.gradle" custom="true" type="gradleReference" />

@GedMarc
Copy link

GedMarc commented Jul 13, 2016

fixgcm

@delgollae
Copy link

Add 'classpath 'com.google.gms:google-services:3.0.0' dependencies at project level build.gradle

Refer the sample block from project level build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {

    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants