gonzaloaune / GCMPushPlugin

Push notifications for Cordova (GCM & Native support)
MIT License
37 stars 20 forks source link

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

Closed prashant-musale closed 9 years ago

prashant-musale commented 9 years ago

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

gonzaloaune commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

Vahn84 commented 8 years ago

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 commented 8 years ago

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

srameshr commented 8 years ago

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 commented 8 years ago

+1 Stuck on this!

srameshr commented 8 years ago

@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 commented 8 years ago

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

GedMarc commented 8 years ago

phonegap push no longer works though, deprecated

GedMarc commented 8 years ago

Add the following to plugin.xml

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

GedMarc commented 8 years ago

fixgcm

delgollae commented 6 years ago

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
}

}

vikashbhr commented 6 years ago

I have this error: Could not find com.google.firebase:firebase-core:17.0.0.

https://jcenter.bintray.com/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.pom https://jcenter.bintray.com/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.jar https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.pom https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.jar https://repo.maven.apache.org/maven2/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.pom https://repo.maven.apache.org/maven2/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.jar https://maven.google.com/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.pom https://maven.google.com/com/google/firebase/firebase-core/17.0.0/firebase-core-17.0.0.jar Required by: project :app

Thanks !