WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
cordova -v
):7.1.0cordova platform ls
):android 6.2.3_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
_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.
Compilation failed; see the compiler error output for details.
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.
_Reproduce this issue; include code to reproduce, if relevant_
_What were you trying to do?_
_Include iOS / Android logs_
Same error here.
@rwillett @katzer I ran into this today (finally updating!). I am NOT on Ionic, this is cordova command line only. I'm at android-sdk 27 according to Android Studio so I'm wondering if this is getting tripped by something else. So
~Q: what version of Node and npm are you using?~
~Q: do you use yarn?~
I'm at node 8.11.1, npm 6.0.0
UPDATE: I have another computer that will install the plugin (but it still has this error) so I doubt the node/npm wild guess has anything to do with it. I'm digging to see if I can find the differences between the two computers.
Looking very closely at the OP's error messages, there's a problem with the import statement. This is different than what I'm running into (although my errors happen at the same place) so I'll not hijack this thread.
But I did solve a similar issue by shotgunning to a combination that does work:
cordova version: 7.1.0 (doesn't work at 8.0.0)
android platform version: 6.3.0 (doesn't work at 6.2.3)
Hi @Tawpie @katzer @rwillett
I tried your configuration of using
cordova version: 7.1.0
android platform version: 6.3.0
I am running this plugin in plain cordova application not using ionic framework or any other such.
Still i am facing the same issue the plugin works perfectly in ios but in android the build fails giving same error above in the issue created. It would be help if any fix is provide. Waiting for an feedback from you guys
@Gamerakki My error was slightly different than yours. You're seeing the first error at the start of the import statement (which may be related to your node packages). My error was that the NotificationChannel property of android.app was undefined (pointing to a problem with the sdk, either it's not up to date or is broken).
To get mine to work (it's working on two systems now), I did the following. I don't know if it's required to do all this, but I did get it to work on two systems that both were erroring during plugin installation.
my android studio (sdk) ended up looking like this. I uninstalled android studio and reinstalled it, then went to tools, "checked" Android SDK Build-Tools 28RC2 and hit apply
install the plugin cordova plugin add cordova-plugin-local-notification
rm -rf node_modules
npm cache clean -f
npm install
cordova platform rm android
cordova platform rm ios
npm i [email protected] -g
cordova platform add android; cordova platform add ios
in step 9 above, watch for errors while the plugins are being installed—cordova-plugin-local-notification should install without error
oh. I forgot to mention the critical step 10.
cordova build android
Hi @Tawpie @katzer @rwillett I tried the above step but still getting that error. Can u please help in this i am stuck in a project its a needed feature . Please help
@Gamerakki as I mentioned, your issue is different than mine—your listing is pointing to the import
statement. import
as you are aware, is a newer JS construct not available in ES5/2015 and your node installation appears (I don't know for sure) to be unable to find the import
statement. I'd suggest a couple of things:
npm ls | grep babel
), these transpile ES6 to ES5. These are the base packages I have installed.import
classI kind of doubt your issue has its root cause in this plugin… it might have something to do with this plugin, but until you can get past the import statement it's difficult for folks supporting this plugin to help.
Hi @Tawpie ,
i went to the error deeply and found that one on the class in android import is not present for the latest local notification plugin. The media style import is failing in the code so i believe its the issue with the plugin and not of npm.
kk. I'm not sure I can help anymore. I got 0.9.0-beta.3 to work for me so I'd just make sure you don't have a bad download of beta.3.
hi @Tawpie can u share the beta plugin 3 on my email id fatalerror.[email protected] would be helpful
you should be able to get beta.3 by cloning or downloading this repo (I would also add the fix discussed in issue 1541 as well) and then installing from your local copy.
Thank you can i know when would u merge the fix with the repo so that i can download any headsup ?
There is a pull request to fix 1541 already but due to what looks like an issue with CI it's not passing testing. Check that issue for details. I'm not the maintainer of this plugin (just a long time user) so I can't speak to when or if anything gets merged.
Still getting bug, help @Tawpie
Your system information:
ordova CLI: 6.4.0
Ionic Framework Version: 3.9.2
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 3.2.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v8.15.1
Xcode version: Not installed
npm -v
6.8.0
someone solved ? how ?
cordova -v
6.4.0
npm -v
6.9.0
@josuper this is a pretty old issue and you should be able to build android—I would recommend you make certain you're using the latest version of the plugin. I believe a number of PRs were merged recently, make sure you're on that version!
Still an issue for me
cordova -v 9.0.0 ([email protected])
npm -v 6.10.0
l faced the same error !!! any help
Same issue, what's the workaround or fix
Same issue, any one here found any solution for this?
Most helpful comment
oh. I forgot to mention the critical step 10.
cordova build android