Cordova-plugin-firebase: Cannot find symbol import android.support.v4.app.NotificationManagerCompat

Created on 18 Jun 2019  路  5Comments  路  Source: arnesson/cordova-plugin-firebase

Hi,
Few days ago I had a problem described in #1058 when building an app, and I fixed it when I followed the steps they suggested. But today when I tried to build for the release I got another error and I can't find the solution for it.

Task :app:compileReleaseJavaWithJavac FAILED
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:9: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
^
symbol: class NotificationManagerCompat
location: package android.support.v4.app
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:11: error: cannot find symbol
import android.support.v4.app.NotificationCompat;
^
symbol: class NotificationCompat
location: package android.support.v4.app
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:358: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
^
symbol: class NotificationManagerCompat
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:358: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
^
symbol: variable NotificationManagerCompat
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
^
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
^
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:153: error: cannot find symbol
.setPriority(NotificationCompat.PRIORITY_MAX);
^
symbol: variable NotificationCompat
location: class FirebasePluginMessagingService
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:149: error: package NotificationCompat does not exist
.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
^
D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:148: error: cannot find symbol
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
^
symbol: variable NotificationCompat
location: class FirebasePluginMessagingService
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.
9 errors
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileReleaseJavaWithJavac'.
    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 13s
    33 actionable tasks: 5 executed, 28 up-to-date
    (node:6280) UnhandledPromiseRejectionWarning: Error: D:\Cordova\MyApp\platforms\android\gradlew: Command failed with exit code 1 Error output:
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:9: error: cannot find symbol
    import android.support.v4.app.NotificationManagerCompat;
    ^
    symbol: class NotificationManagerCompat
    location: package android.support.v4.app
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:11: error: cannot find symbol
    import android.support.v4.app.NotificationCompat;
    ^
    symbol: class NotificationCompat
    location: package android.support.v4.app
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:358: error: cannot find symbol
    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
    ^
    symbol: class NotificationManagerCompat
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePlugin.java:358: error: cannot find symbol
    NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context);
    ^
    symbol: variable NotificationManagerCompat
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
    ^
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:144: error: package NotificationCompat does not exist
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
    ^
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:153: error: cannot find symbol
    .setPriority(NotificationCompat.PRIORITY_MAX);
    ^
    symbol: variable NotificationCompat
    location: class FirebasePluginMessagingService
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:149: error: package NotificationCompat does not exist
    .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
    ^
    D:\Cordova\MyApp\platforms\android\app\srcmain\java\org\apache\cordovafirebase\FirebasePluginMessagingService.java:148: error: cannot find symbol
    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
    ^
    symbol: variable NotificationCompat
    location: class FirebasePluginMessagingService
    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.
    9 errors
    FAILURE: Build failed with an exception.
  • What went wrong:
    Execution failed for task ':app:compileReleaseJavaWithJavac'.
    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 13s
at ChildProcess.whenDone (D:\Cordova\MyAppnode_modules\cordova-common\src\superspawn.js:135:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at ChildProcess.cp.emit (D:\Cordova\MyAppnode_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:6280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6280) [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.

Most helpful comment

@madzgo That didn't work for me. I was able to fix it with this hook #1083 (comment)

This worked for me.

All 5 comments

Go to platforms/android/cordova-plugin-firebase/-build.gradle
and change
compile 'com.google.firebase:firebase-auth:+'
to
compile 'com.google.firebase:firebase-auth:16.+'

Also check #1081 as there was a major google update yesterday.

I faced that error too today. If that could help the related one is https://github.com/arnesson/cordova-plugin-firebase/issues/1081

Had to add support for androidx and it started working again.

@madzgo That didn't work for me. I was able to fix it with this hook #1083 (comment)

This worked for me.

@madzgo That didn't work for me. I was able to fix it with this hook #1083 (comment)

This worked for me.

Thank you @mishkeTz , really work again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LKruglov picture LKruglov  路  4Comments

JonSmart picture JonSmart  路  3Comments

arunkatariaoodles picture arunkatariaoodles  路  4Comments

dhavalsoni2001 picture dhavalsoni2001  路  5Comments

stephan-nordnes-eriksen picture stephan-nordnes-eriksen  路  5Comments