Cordova-plugin-local-notifications: Ionic app doesn't build

Created on 21 Dec 2017  ·  9Comments  ·  Source: katzer/cordova-plugin-local-notifications

After installing the plugin in the app, then building it and running it in a mobile device it the app crashes and show's (app has stopped).

Your Environment

  • Plugin version: 0.8.4
  • Platform: Android
  • OS version: 7.0
  • Device manufacturer / model: J7 max
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls):
  • Plugin config
  • Ionic Version (if using Ionic) 3.19.0

Expected Behavior

The app should have built properly, showing the homepage

Actual Behavior

The app crashes.

Context

I trying to create a todo list application were i am using fcm for sharing list with other user's and set a location alert which will notify to the user locally.

Most helpful comment

Oh I forgot to say that if you hadn't device plugin you should install it first too....
So the correct sequence would be:
ionic cordova plugin add cordova-plugin-device
npm install --save @ionic-native/device
ionic cordova plugin add cordova-plugin-app-event
ionic cordova plugin add [email protected]
npm install --save @ionic-native/local-notifications

All 9 comments

I'm getting the same issue, so I'm adding my own received message by the CLI 👍

CLI's error message

Error: cmd: 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.
C:UsersPCtheLastProjectplatformsandroidsrcdeappplantcordovapluginnotificationManager.java:24: error: cannot find symbol
import android.app.NotificationChannel;
^
symbol: class NotificationChannel
location: package android.app
C:UsersPCtheLastProjectplatformsandroidsrcdeappplantcordovapluginnotificationManager.j
ava:41: error: cannot find symbol
import static android.os.Build.VERSION_CODES.O;
^
symbol: static O
location: class
C:UsersPCtheLastProjectplatformsandroidsrcdeappplantcordovapluginnotificationManager.j
ava:109: error: cannot find symbol
if (SDK_INT < O)
^
symbol: variable O
location: class Manager
C:UsersPCtheLastProjectplatformsandroidsrcdeappplantcordovapluginnotificationManager.java:112: error: cannot find symbol
NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID);
^
symbol: class NotificationChannel
location: class Manager
C:UsersPC\platformsandroidsrcdeappplantcordovapluginnotificationManager.java:112: error: cannot find symbol
NotificationChannel channel = mgr.getNotificationChannel(CHANNEL_ID);
^
symbol: method getNotificationChannel(String)
location: variable mgr of type NotificationManager
C:UsersPC\platformsandroidsrcdeappplantcordovapluginnotificationManager.java:117: error: cannot find symbol
channel = new NotificationChannel(
^
symbol: class NotificationChannel
location: class Manager
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors

FAILURE: Build failed with an exception.

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

My environnement

  • Plugin version: 0.9.0-beta.1
  • Platform: Android
  • OS version: 7.0
  • Device manufacturer / model: Sony Xperia XA1
  • Cordova version (cordova -v): 7.1.0
  • Cordova platform version (cordova platform ls):

    • Installed platforms: android 6.2.3

  • Plugin config (cordova plugin ls)

    • cordova-plugin-background-mode 0.7.2 "BackgroundMode"

    • cordova-plugin-badge 0.8.5 "Badge"

    • cordova-plugin-device 1.1.4 "Device"

    • cordova-plugin-ionic-webview 1.1.11 "Ionic's WKWebView Engine"

    • cordova-plugin-local-notification 0.9.0-beta.1 "LocalNotification"

    • cordova-plugin-native-spinner 1.1.3 "Native Spinner"

    • cordova-plugin-splashscreen 4.0.3 "Splashscreen"

    • cordova-plugin-whitelist 1.3.1 "Whitelist"

    • ionic-plugin-keyboard 2.2.1 "Keyboard"

  • Ionic Version (if using Ionic) 3.19.0

Same here....same as Youtch.
My device is a Samsung with Android 5.1
and Ionic 3.9.2

Same error.

plugin version: 0.8.4
Tested Android versions: 8.0 - 7.1.1

stoperror

Hi I solved the problem with the local notification install...at least for me...but I guess it's gonna help you guys as well....
So first of all, uninstall your previous attempts to install local notification plugin

If you couldn't remove the folder via command line do it manually and remove it from package.json too.
Then run:
ionic cordova plugin add cordova-plugin-app-event
ionic cordova plugin add [email protected]
npm install --save @ionic-native/local-notifications
I tried installing with nofetch option and it installing but no building...the way I showed from above is gonna work

Oh I forgot to say that if you hadn't device plugin you should install it first too....
So the correct sequence would be:
ionic cordova plugin add cordova-plugin-device
npm install --save @ionic-native/device
ionic cordova plugin add cordova-plugin-app-event
ionic cordova plugin add [email protected]
npm install --save @ionic-native/local-notifications

Thanks. code is worked after I added cordova-plugin-device plugin

Bravo !
Now I don't get any error to build after I removed
katzer/cordova-plugin-local-notification and I installed
de.appplant.cordova. plugin.local-notification 0.8.5. This installed the
dependances plugins given above.

Le 31 déc. 2017 10:37, "supermaker" notifications@github.com a écrit :

Thanks. code is worked after I added cordova-plugin-device plugin


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/katzer/cordova-plugin-local-notifications/issues/1477#issuecomment-354594290,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIfMuITmdHM_4qvw7PNbTaRyApD2hSgvks5tF1XIgaJpZM4RKJi2
.

Please always see the tagged README for your plugin version. cordova-plugin-local-notification is the new id since v0.9

Was this page helpful?
0 / 5 - 0 ratings