wizpanda / cordova-plugin-firebase-lib

This repository is moving & merging to https://github.com/wizpanda/cordova-plugin-firebase-lib to avoid confusion to developers.
https://www.wizpanda.com/
MIT License
68 stars 38 forks source link

Build issue on Android #12

Closed charpour closed 5 years ago

charpour commented 5 years ago

cordova-plugin-firebase-lib version: 3.1.0 cordova-android version: 8.0.0 cordova version: 9.0.0

Describe the bug The build fails (cordova build android)

Here's the output:

BUILD FAILED in 1s
33 actionable tasks: 5 executed, 28 up-to-date
<dir>/platforms/android/gradlew: Command failed with exit code 1 Error output:
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:11: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
                             ^
  symbol:   class NotificationCompat
  location: package android.support.v4.app
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:9: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
                             ^
  symbol:   class NotificationManagerCompat
  location: package android.support.v4.app
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:17: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
                             ^
  symbol:   class NotificationCompat
  location: package android.support.v4.app
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                              ^
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                                                   ^
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:153: error: cannot find symbol
                    .setPriority(NotificationCompat.PRIORITY_MAX);
                                 ^
  symbol:   variable NotificationCompat
  location: class FirebasePluginMessagingService
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:149: error: package NotificationCompat does not exist
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
                                                    ^
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:148: error: cannot find symbol
                    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                                   ^
  symbol:   variable NotificationCompat
  location: class FirebasePluginMessagingService
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:119: error: cannot find symbol
        int visibility = channel.optInt(VISIBILITY, NotificationCompat.VISIBILITY_PUBLIC);
                                                    ^
  symbol:   variable NotificationCompat
  location: class FirebasePlugin
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:452: error: cannot find symbol
                    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
                    ^
  symbol: class NotificationManagerCompat
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:452: error: cannot find symbol
                    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
                                                                          ^
  symbol: variable NotificationManagerCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
11 errors

FAILURE: Build failed with an exception.

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

Then I added cordova-plugin-android-support-v4 and now I'm getting this:

BUILD FAILED in 1s
33 actionable tasks: 7 executed, 26 up-to-date
<dir>/platforms/android/gradlew: Command failed with exit code 1 Error output:
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
<dir>/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:453: error: cannot find symbol
                    boolean areNotificationsEnabled = notificationManagerCompat.areNotificationsEnabled();
                                                                               ^
  symbol:   method areNotificationsEnabled()
  location: variable notificationManagerCompat of type NotificationManagerCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build failed with an exception.

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

Strange thing is that I haven't changed anything in the project and it was compiling without issues last week. Ideas or suggestions more than welcome.

steosoft commented 5 years ago

I have the same issue :( Please help

henlocon commented 5 years ago

I'll just leave this here... :(

https://firebase.google.com/support/release-notes/android#update_-_june_17_2019

sagrawal31 commented 5 years ago

We are working on it.

charpour commented 5 years ago

Good to know, thank you for spending the time to fix it. Much appreciated.

sagrawal31 commented 5 years ago

@charpour comments on this https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/13?

sayedeltokhy commented 5 years ago

Same Issue here

\src\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginMessagingService.java:144: error: constructor Builder in class Builder cannot be applied to given types; NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
sagrawal31 commented 5 years ago

Released v3.3.0 to support cordova-android 7.x.x. https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/14#issuecomment-503499409