Open bar-c opened 6 years ago
@bar-c I strongly recommend to upgrading to the 2.x versions of the plugin that support FCM.
I need more info as I can see you are getting a JSON exception in Java but none of the logs before that are shown. Running adb logcat | grep Push
would help.
@macdonst thanks! i'll run it as you said . we also tried upgrading to the 2.x versions, more specifically 2.1.0 and when trying to compile for android we get this error:
ANDROID_HOME=/home/bcardoso/apps/android-sdk JAVA_HOME=/usr/lib/jvm/java-8-oracle Subproject Path: CordovaLib The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead. at build_80taxggsi3d4l55fobiolz38i.run(/home/bcardoso/Supervielle/Supervielle_deploy_pushPlugin2.1.0/platforms/android/build.gradle:142) Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
FAILURE: Build failed with an exception.
Where: Script '/home/bcardoso/Supervielle/Supervielle_deploy_pushPlugin2.1.0/platforms/android/phonegap-plugin-push/mBanking-push.gradle' line: 38
What went wrong: A problem occurred evaluating root project 'android'.
Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin'] For input string: "+"
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s (node:4234) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /home/bcardoso/Supervielle/Supervielle_deploy_pushPlugin2.1.0/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.
Where: Script '/home/bcardoso/Supervielle/Supervielle_deploy_pushPlugin2.1.0/platforms/android/phonegap-plugin-push/mBanking-push.gradle' line: 38
What went wrong: A problem occurred evaluating root project 'android'.
Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin'] For input string: "+"
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s (node:4234) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@bar-c yeah, it is failing to build because of #1718. See the last comment that explains the bug that Google has. In the meantime I've made it possible to set the play services/fcm version. You've probably got another plugin trying to include the same library.
@macdonst yes, we had google analytics which we already removed. Is it imperative that we change branches 1.x to 2.x? Do you know if the device date and time influences the plugin or the expiration of the registrationId (if it had any)? thank you!
@macdonst I'm having trouble finding documentation on how to set the play services/fcm version. Currently I am doing this in the config.xml:
It still does not work when I try to deploy the app using PGB, still the same error: Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
For input string: "+"
Could you point me in the right direction?
@chadmilden look for any firebase and/or play services dependencies in your platforms/android/build.gradle (and also in any extra .gradle file of your cordova plugins) and replace all the ":+" with a specific play services version. For example:
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: "CordovaLib"))
compile "com.google.gms:google-services:+" // this is OK (it is not *play* services)
compile "com.google.android.gms:play-services-tagmanager:11.6.2" // REPLACED
compile "com.google.firebase:firebase-core:11.6.2" // REPLACED
compile "com.google.firebase:firebase-crash:11.6.2" // REPLACED
compile "com.google.firebase:firebase-config:11.6.2" // REPLACED
compile "com.google.firebase:firebase-messaging:11.6.2" // REPLACED
}
@kareraisu unfortunately I use phoneGapBuild to create ios and android install files. one of the caveats of phoneGapBuild is that you can't have any pre-build hooks, and you can't manually edit the build.gradle file, everything must work well together without manual or hook intervention. I'm still waiting for a fix or instrutions to get this working with phoneGapBuild.
Expected Behaviour
Register the device when the app starts obtaining a registrationId
Actual Behaviour
We have noticed that on some devices the registration is successful and on other fails, executing the push.on('error') message.
Additional Details
Looking at the docs, we see:
push.on('error', callback) The event error will trigger when an internal error occurs and the cache is aborted.
But we can't understand what internal error might be ocurring. If we delete the app's data and cache on the device, we receive a new registrationId and in this case it happens that the registration can be succesful the first time, or we clean data+ cache a few times and starts working. We noticed that on devices runing on Android 7.0 the registration is always succesful.
Reproduce Scenario (including but not limited to)
Initialize the plugin following the README example code:
this.registerPushNotification = function(cb) {
the function registerPushNotification, is called from a service when the app is initializing
Steps to Reproduce
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 7.0/6.0.1/4.4.2
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
Tested on androids : Samsung S7/S8 and Motorola (moto g)
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
Sample Code that illustrates the problem
Code above
Logs taken while reproducing problem
We have the logs the client provided while logging on Android Studio
02-27 15:37:40.023 12910-12990/? E/PushPlugin: execute: Got JSON Exception RST 02-27 15:37:40.023 12910-12990/? D/PushPlugin: no icon option 02-27 15:37:40.023 12910-12990/? D/PushPlugin: no iconColor option 02-27 15:37:40.030 12910-12910/? D/SystemWebChromeClient: file:///android_asset/www/common/service/pushNotification/pushNotification.js: Line 110 : [ERROR] Push-error: RST 02-27 15:37:40.030 12910-12910/? I/chromium: [INFO:CONSOLE(110)] "[ERROR] Push-error: RST", source: file:///android_asset/www/common/service/pushNotification/pushNotification.js (110)
thank you!