cordova-plugin-local-notifications: Getting error when I try to build after using this plugin

WARNING: IF YOU IGNORE THIS TEMPLATE, WE’LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

  • Plugin version:0.9.0-beta.2
  • Platform:Android
  • OS version:Mac
  • Device manufacturer / model:
  • Cordova version (cordova -v):7.1.0
  • Cordova platform version (cordova platform ls):android 6.2.3
  • Plugin config
  • Ionic Version (if using Ionic):2.2.2

Expected Behavior

Tell us what should happen I installed the plugin using instructions given here: https://ionicframework.com/docs/native/local-notifications/ When I run the build I get below error

Actual Behavior

Tell us what happens instead

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:25: error: cannot find symbol

import android.app.NotificationChannel; ^ symbol: class NotificationChannel location: package android.app

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:32: error: package android.support.v4.media.app.NotificationCompat does not exist

import android.support.v4.media.app.NotificationCompat.MediaStyle; ^

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:43: error: cannot find symbol

import static android.os.Build.VERSION_CODES.O; ^ symbol: static O location: class

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:112: error: cannot find symbol

    if (SDK_INT < O)
                  ^

symbol: variable O location: class Manager

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:115: error: cannot find symbol

    NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID);
    ^

symbol: class NotificationChannel location: class Manager

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:115: error: cannot find symbol

    NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID);
                                     ^

symbol: method getNotificationChannel(String) location: variable mgr of type NotificationManager

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:120: error: cannot find symbol

    channel = new NotificationChannel(
                  ^

symbol: class NotificationChannel location: class Manager

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:130: error: cannot find symbol .setChannelId(options.getChannel()) ^

symbol: method setChannelId(String) location: class Builder

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:296: error: cannot find symbol

    MediaStyle style;
    ^

symbol: class MediaStyle location: class Builder

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:298: error: cannot find symbol style = new MediaStyle(builder)

                ^

symbol: class MediaStyle location: class Builder

/my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:417: error: constructor Builder in class Builder cannot be applied to given types;

        builder = new NotificationCompat.Builder(context, options.getChannel());
                  ^

required: Context found: Context,String

reason: actual and formal argument lists differ in length

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.

11 errors

:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘: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.

BUILD FAILED

Total time: 11.407 secs

Error: /my-project/platforms/android/gradlew: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:25: error: cannot find symbol import android.app.NotificationChannel; ^ symbol: class NotificationChannel location: package android.app /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:32: error: package android.support.v4.media.app.NotificationCompat does not exist import android.support.v4.media.app.NotificationCompat.MediaStyle; ^ /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:43: error: cannot find symbol import static android.os.Build.VERSION_CODES.O; ^ symbol: static O location: class /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:112: error: cannot find symbol if (SDK_INT < O) ^ symbol: variable O location: class Manager /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:115: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: class NotificationChannel location: class Manager /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:115: error: cannot find symbol NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID); ^ symbol: method getNotificationChannel(String) location: variable mgr of type NotificationManager /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Manager.java:120: error: cannot find symbol channel = new NotificationChannel( ^ symbol: class NotificationChannel location: class Manager /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:130: error: cannot find symbol .setChannelId(options.getChannel()) ^ symbol: method setChannelId(String) location: class Builder /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:296: error: cannot find symbol MediaStyle style; ^ symbol: class MediaStyle location: class Builder /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:298: error: cannot find symbol style = new MediaStyle(builder) ^ symbol: class MediaStyle location: class Builder /my-project/platforms/android/src/de/appplant/cordova/plugin/notification/Builder.java:417: error: constructor Builder in class Builder cannot be applied to given types; builder = new NotificationCompat.Builder(context, options.getChannel()); ^ required: Context found: Context,String reason: actual and formal argument lists differ in length 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. 11 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘: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.

Steps to Reproduce

Reproduce this issue; include code to reproduce, if relevant

  1. Install the @ionic-native/local-notification
  2. run ionic build

Context

What were you trying to do?

Debug logs

Include iOS / Android logs

  • ios XCode logs
  • Android: $ adb logcat

About this issue

Most upvoted comments

oh. I forgot to mention the critical step 10.

  1. Cross your fingers, find your lucky charm and hold it close to your left ear then turn around clockwise three times. With your eyes still closed, reverently face your computer and chant (softly): “oh mighty machine”. Bowing down to the computer is optional. Then run cordova build android

l faced the same error !!! any help