phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Run Android Firebase error all of a sudden #2768

Open minimedj opened 5 years ago

minimedj commented 5 years ago

Hello, I am building a mobile app using Cordova. It was compiling perfectly ok for a few dozens builds, no problem whatsoever.

Today I tried to compile my app again and all of a sudden, it fails during compilation with:

:app:javaPreCompileDebug
platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:9: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
                              ^
  symbol:   class FirebaseInstanceIdService
  location: package com.google.firebase.iid
platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:15: error: cannot find symbol
public class PushInstanceIDListenerService extends FirebaseInstanceIdService implements PushConstants {
                                                   ^
  symbol: class FirebaseInstanceIdService
platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:18: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
45 actionable tasks: 41 executed, 4 up-to-date

I am using the below cordova plugins (and was using the same when it was compiling ok):

$ cordova plugin list

cordova-clipboard 1.2.1 "Clipboard"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-apprate 1.4.0 "AppRate"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-customurlscheme 4.3.0 "Custom URL scheme"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-googlemaps 2.5.2 "cordova-plugin-googlemaps"
cordova-plugin-hostedwebapp 0.3.1 "HostedWebApp"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-native-keyboard 2.0.2 "Native Keyboard"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-request-location-accuracy 2.2.3 "Request Location Accuracy"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
cordova.plugins.diagnostic 4.0.12 "Diagnostic"
phonegap-plugin-barcodescanner 8.0.1 "BarcodeScanner"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.2.3 "PushPlugin"

I tried whatever I could find on the net, but nothing changed.

It seems that the probblem is because of Firebase update made in April.

Guys from cordova-plugin-firebase plugin had the same problem. Discussion: here. Their fix: here.

Any ideas? (as it is for a project with a deadline in 5 days, I would really appreciate any help I can get quickly)…

MANY thanks!

vahvarh commented 5 years ago

Same here. Any results?

nerycordova commented 5 years ago

Hi there. A dirty hack I found is to delete this file and run the build again: platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java

jorgehclinhares commented 4 years ago

Same problem...

@idesisnery solved the issue, but I don't know how much it can negatively impact my application.

LucaTrip commented 4 years ago

Same problem after migration from cordova-android 7 to cordova-android 8. Have you solved somehow?

noahcooper commented 4 years ago

I ran into this issue, and was able to fix it by setting the FCM_VERSION variable. This plugin will not work with any version later than 17.5.0.

cordova plugin add phonegap-plugin-push@2.3.0 --variable FCM_VERSION="17.5.0"

If you have other plugins that use Firebase Messaging, you might also need to use cordova-android-firebase-gradle-release to force 17.5.0 to be used.