React-native-notifee: error: package io.invertase.notifee does not exist

Created on 11 Oct 2020  路  11Comments  路  Source: notifee/react-native-notifee

I just installed this library, followed (https://notifee.app/react-native/docs/installation)

In react-native version "react-native": "0.61.3", it worked perfectly .
In "react-native": "0.62.2", worked perfectly on ios too, but when tried to install on Windows , it gave me the following error.

F:\React Native\MotivateMD\mmd-mob\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:15: error: package io.invertase.notifee does not exist
import io.invertase.notifee.NotifeePackage;
                           ^
F:\React Native\MotivateMD\mmd-mob\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:103: error: cannot find symbol
      new NotifeePackage(),
          ^
  symbol:   class NotifeePackage
  location: class PackageList
Note: F:\React Native\MotivateMD\mmd-mob\android\app\src\debug\java\com\thepremedapp\ReactNativeFlipper.java uses or overrides a deprecated API. 
Note: Recompile with -Xlint:deprecation for details.
2 errors

package.json

 "@notifee/react-native": "^0.14.0",
 "react": "16.11.0",
 "react-native": "0.62.2",

React Native Info

System:
    OS: Windows 10 10.0.19041
    CPU: (4) x64 Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz      
    Memory: 4.89 GB / 11.92 GB
  Binaries:
    Node: 10.15.2 - E:\node.EXE
    Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.4.1 - E:\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 23.0.1, 28.0.3, 29.0.2
      Android NDK: Not Found
    Windows SDK: Not Found
Android customer-response bug

All 11 comments

Interesting. I wonder if your auto-linking is not set up correctly somehow.
Seeing your android/build.gradle and android/app/build.gradle files might be instructive.
I'm not sure if this work on Windows (perhaps it will with Windows Subsystem for Linux?) but I have a script that shows correct integration and works on linux and macOS at least. I haven't tried it on windows but we have not had any complaints yet so I suspect this is project specific - https://github.com/mikehardy/rnfbdemo/blob/master/notifee-demo.sh

You can verify if it is the module or your project by making a new project with nothing but notifee and testing it - I think this is the right series of commands that will work from scratch assuming you have npx in your path. I use yarn normally but npm is built in so should work if I got the command correct

npx react-native init NotifeeTest
cd NotifeeTest
npm i @notifee/react-native
npx react-native run-android

@mikehardy maybe you are right, this might be a project-specific and OS-specific issue. Worked well in the same project on Mac, but did not work on Windows.
I tried this library in a new project with the same react-native version , it worked as expected.

Any ideas what could the issue in my project which is giving me this error ?

It's possible we have an error that is WIndows-specific, I'm looking at it from that angle as a strong possibility if we can eliminate project-specific problems.

You confirm you ran your exact same project, no changes from source control, and it worked on macOS but not Windows, correct? If correct, then I need to set up a windows test rig and reproduce it

@mikehardy Yes, same project worked on macOS without any changes from source control but not windows.
Do u have any probable solution for now which can be implemented in my project ?

Very strange, I just brought up a react-native development environment on win10 and doing a react-native init on a new project followed by a npm install of this library and then a npm run android all worked fine. I was able to use the notifee API to pop up a notification via a small change to the example App.js and everything. So I can't reproduce. I'd encourage you to try an empty project from init as a test to see if it works for you too.

@mikehardy yes I tried in init project , it's working . But it not working in my existing project. Don't know what could be issue

@hrishiakhade unfortunately if I can't reproduce this I can't fix it - if you can demonstrate the problem starting with react-native init I can look at it again and try to help

Hello, I'm seeing the same issue after upgrading Notifee from 0.9.1 to 0.14.0. I'm using React Native 0.63.3, and running this on a Mac. 0.9.1 worked fine for me, but 0.14.0 won't build on Android with the same error the OP mentioned.
Another error worth noting from Android Studio is:

ERROR: The module 'notifee_react-native' is an Android project without build variants, and cannot be built.
Please fix the module's configuration in the build.gradle file and sync the project again.

I wish I could help, however my last comment stands and I don't have anything actionable:

unfortunately if I can't reproduce this I can't fix it - if you can demonstrate the problem starting with react-native init I can look at it again and try to help

I'm able to reproduce it locally on a fresh install of react native. I added all my dependencies and figured out that using OneSignal was causing this build problem.
Adding apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' to the top of my app/build.gradle causes the error. I hope this helps in resolving the problem.

That's good information, but I'm not sure how we can manage a problem caused by the onesignal gradle plugin. I believe there was someone else with this problem and they achieved successful onesignal integration without the plugin even ? We changed our docs in response: https://github.com/notifee/documentation/commit/7249b1d497b7dac9765677642aae970c09cb93b7

Was this page helpful?
0 / 5 - 0 ratings

Related issues

umang-simform picture umang-simform  路  12Comments

mars-lan picture mars-lan  路  9Comments

robertqin86 picture robertqin86  路  3Comments

beweinreich picture beweinreich  路  9Comments

kperreau picture kperreau  路  6Comments