invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

[Expo] Could not find any matches for app.notifee:core #911

Closed dilshadansari12 closed 9 months ago

dilshadansari12 commented 1 year ago

working on an Expo project and following the documentation to integrate the Notifee plugin. After completing the setup steps, I encountered an error when running npx expo run:android.

-> npx expo run:android › Building app... Configuration on demand is an incubating feature. node:internal/process/promises:279 triggerUncaughtException(err, true / fromPromise /); ^

C:\Users\Dilshad\Desktop\notifee\node_modules\react-native\index.js:14 import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1126:15) at Module._compile (node:internal/modules/cjs/loader:1162:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) at Module.load (node:internal/modules/cjs/loader:1076:32) at Function.Module._load (node:internal/modules/cjs/loader:911:12) at Module.require (node:internal/modules/cjs/loader:1100:19) at require (node:internal/modules/cjs/helpers:119:18) at Object. (C:\Users\Dilshad\Desktop\notifee\node_modules\@notifee\react-native\dist\NotifeeApiModule.js:9:24) at Module._compile (node:internal/modules/cjs/loader:1198:14) { code: 'INVALID_PLUGIN_IMPORT', cause: undefined, name: 'PluginError', isPluginError: true }

FAILURE: Build failed with an exception.

BUILD FAILED in 1s Error: C:\Users\Dilshad\Desktop\notifee\android\gradlew.bat exited with non-zero code: 1
Error: C:\Users\Dilshad\Desktop\notifee\android\gradlew.bat exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at ChildProcess.cp.emit (C:\Users\Dilshad\Desktop\notifee\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1100:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) ... at Object.spawnAsync [as default] (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
at spawnGradleAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
at Object.assembleAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
at runAndroidAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24) at processTicksAndRejections (node:internal/process/task_queues:96:5)

### I came across information on Google suggesting that Notifee no longer requires additional plugin installations and can be used directly. In an attempt to follow this approach, I encountered errors

npx expo run:android › Building app... Configuration on demand is an incubating feature.

Configure project :notifee_react-native :notifee_react-native @notifee/react-native found at C:\Users\Dilshad\Desktop\notifee\node_modules\@notifee\react-native :notifee_react-native package.json found at C:\Users\Dilshad\Desktop\notifee\node_modules\@notifee\react-native\package.json :notifee_react-native:version set from package.json: 7.8.0 (7,8,0 - 7008000) :notifee_react-native:android.compileSdk using custom value: 33 :notifee_react-native:android.targetSdk using custom value: 33 :notifee_react-native:android.minSdk using custom value: 21 :notifee_react-native:reactNativeAndroidDir C:\Users\Dilshad\Desktop\notifee\node_modules\react-native\android

Configure project :expo

Using expo modules

FAILURE: Build failed with an exception.

BUILD FAILED in 20s 5 actionable tasks: 5 up-to-date Error: C:\Users\Dilshad\Desktop\notifee\android\gradlew.bat exited with non-zero code: 1 Error: C:\Users\Dilshad\Desktop\notifee\android\gradlew.bat exited with non-zero code: 1 at ChildProcess.completionListener (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at ChildProcess.cp.emit (C:\Users\Dilshad\Desktop\notifee\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1100:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) ... at Object.spawnAsync [as default] (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
at spawnGradleAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
at Object.assembleAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
at runAndroidAsync (C:\Users\Dilshad\Desktop\notifee\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24) at processTicksAndRejections (node:internal/process/task_queues:96:5)

mikehardy commented 1 year ago

I came across information on Google suggesting that Notifee no longer requires additional plugin installations and can be used directly. In an attempt to follow this approach, I encountered errors

That appears to contradict our documentation https://notifee.app/react-native/docs/installation#expo-support

You will need a plugin. It works if you follow our documentation I believe?

dilshadansari12 commented 1 year ago

I followed these steps as mentioned in the documentation ;

package install => npm install --save @notifee/react-native ( look ⬇️);

"dependencies": { "@notifee/react-native": "^7.8.0", "expo": "~49.0.15", "expo-splash-screen": "~0.20.5", "expo-status-bar": "~1.6.0", "react": "18.2.0", "react-native": "0.72.6" },

insert plugin => "plugins": ["@notifee/react-native" ] ( look⬇️);

{ "expo": { "name": "test", "slug": "test", "version": "1.0.0", "orientation": "portrait", "icon": "./assets/icon.png", "userInterfaceStyle": "light", "splash": { "image": "./assets/splash.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "assetBundlePatterns": [ "*/" ], "ios": { "supportsTablet": true }, "android": { "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, "package": "com.mojahid1997.test" }, "web": { "favicon": "./assets/favicon.png" }, "plugins": [ "@notifee/react-native" ] } } ;

when I try to run a project

npx expo run:android › Building app... Configuration on demand is an incubating feature. node:internal/process/promises:288 triggerUncaughtException(err, true / fromPromise /); ^

C:\Users\Dilshad\Desktop\test\node_modules\react-native\index.js:14 import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1178:20) at Module._compile (node:internal/modules/cjs/loader:1220:27) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:119:18) at Object. (C:\Users\Dilshad\Desktop\test\node_modules\@notifee\react-native\dist\NotifeeApiModule.js:9:24) at Module._compile (node:internal/modules/cjs/loader:1256:14) { code: 'INVALID_PLUGIN_IMPORT', cause: undefined, name: 'PluginError', isPluginError: true }

Node.js v18.18.1

FAILURE: Build failed with an exception.

BUILD FAILED in 1s Error: C:\Users\Dilshad\Desktop\test\android\gradlew.bat exited with non-zero code: 1
Error: C:\Users\Dilshad\Desktop\test\android\gradlew.bat exited with non-zero code: 1
at ChildProcess.completionListener (C:\Users\Dilshad\Desktop\test\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23) at Object.onceWrapper (node:events:632:26) at ChildProcess.emit (node:events:517:28) at cp.emit (C:\Users\Dilshad\Desktop\test\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1098:16) at ChildProcess._handle.onexit (node:internal/child_process:303:5) ... at Object.spawnAsync [as default] (C:\Users\Dilshad\Desktop\test\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21) at spawnGradleAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46) at Object.assembleAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
at runAndroidAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

after some Google i found this 👉

[Android/iOS]: BREAKING CHANGE: For Expo, there is no config plugin anymore, please remove the plugin from app.config.js (See https://github.com/invertase/notifee/issues/811). ;

and I also try without a plugin and this time i get this error ;

npx expo run:android › Building app... Configuration on demand is an incubating feature.

Configure project :notifee_react-native :notifee_react-native @notifee/react-native found at C:\Users\Dilshad\Desktop\test\node_modules\@notifee\react-native :notifee_react-native package.json found at C:\Users\Dilshad\Desktop\test\node_modules\@notifee\react-native\package.json :notifee_react-native:version set from package.json: 7.8.0 (7,8,0 - 7008000) :notifee_react-native:android.compileSdk using custom value: 33 :notifee_react-native:android.targetSdk using custom value: 33 :notifee_react-native:android.minSdk using custom value: 21 :notifee_react-native:reactNativeAndroidDir C:\Users\Dilshad\Desktop\test\node_modules\react-native\android

Configure project :expo

Using expo modules

FAILURE: Build failed with an exception.

BUILD FAILED in 17s 5 actionable tasks: 5 up-to-date Error: C:\Users\Dilshad\Desktop\test\android\gradlew.bat exited with non-zero code: 1 Error: C:\Users\Dilshad\Desktop\test\android\gradlew.bat exited with non-zero code: 1 at ChildProcess.completionListener (C:\Users\Dilshad\Desktop\test\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23) at Object.onceWrapper (node:events:632:26) at ChildProcess.emit (node:events:517:28) at cp.emit (C:\Users\Dilshad\Desktop\test\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1098:16) at ChildProcess._handle.onexit (node:internal/child_process:303:5) ... at Object.spawnAsync [as default] (C:\Users\Dilshad\Desktop\test\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21) at spawnGradleAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46) at Object.assembleAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18) at runAndroidAsync (C:\Users\Dilshad\Desktop\test\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

please assist me how i do

dilshadansari12 commented 1 year ago

All problems arise in Expo 49. I tried it in Expo 48, and it worked perfectly. However, in Expo 49, there are errors. We would be very thankful if you could address this issue and provide an update in the documentation, please

mikehardy commented 1 year ago

Expo support is community provided - I do not personally use Expo so I will not be able to help

If it worked in Expo 48 but does not in Expo 49 someone (could be you!) needs to look at what changed between the two versions and propose a PR to our documentation (there is an edit button at the top right of every docs page, updates are easy)

dilshadansari12 commented 1 year ago

ok, I will try ;

but for now, I noticed some required action in this pr -https://github.com/invertase/notifee/commit/c441b9a5011fdac4332ca4bc6b5b907a6fff3e88 some changes in installation with expo, this changes also updated in https://github.com/invertase/notifee/blob/main/docs-react-native/react-native/docs/installation.md but in web page not updated;

ryonwhyte commented 1 year ago

I had the same issues you described. In my case i removed the config plugin as it is no longer required and added this maven Repo. Make sure to install expo-build-properties

"plugins": [ [ "expo-build-properties", { "android": { "extraMavenRepos": [ "../../node_modules/@notifee/react-native/android/libs" ] } } ], } @dilshadansari12

dilshadansari12 commented 1 year ago

is this working on your expo version 49 ; @ryonwhyte

ryonwhyte commented 1 year ago

@dilshadansari12 Yes, I am on expo 49.

github-actions[bot] commented 11 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

suhail135 commented 11 months ago

this worked for me.

npx expo install expo-build-properties

  "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "extraMavenRepos": [
              "../../node_modules/@notifee/react-native/android/libs"
              ]
          },
          "ios": {  }
        }
      ],
      "@react-native-firebase/app",
      "@react-native-firebase/messaging"
    ],
github-actions[bot] commented 10 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

anubisdark commented 9 months ago

Hi there,

i have the same issue, but i don't take any solution. I change config of plugin in my app-config.js for this configuration: [ "expo-build-properties", { "android": { "usesCleartextTraffic": true, "extraMavenRepos": [ "../../node_modules/@notifee/react-native/android/libs", ] }, "ios": { "useFrameworks": "static" } } ], ["@react-native-firebase/app",], ["@react-native-firebase/messaging"],

But compiler said same issiue:

FAILURE: Build failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 33s 15 actionable tasks: 15 up-to-date Error: /home/emmanuel/Documentos/ttk-responsiveIOS/android/gradlew exited with non-zero code: 1 Error: /home/emmanuel/Documentos/ttk-responsiveIOS/android/gradlew exited with non-zero code: 1 at ChildProcess.completionListener (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at Object.spawnAsync [as default] (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21) at spawnGradleAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46) at Object.assembleAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18) at runAndroidAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24)

i running my project in version 49.0.16 of expo. But i don't find any solution of this issie.

Dilantha-Wijesinghe commented 5 months ago

Hi there,

i have the same issue, but i don't take any solution. I change config of plugin in my app-config.js for this configuration: [ "expo-build-properties", { "android": { "usesCleartextTraffic": true, "extraMavenRepos": [ "../../node_modules/@notifee/react-native/android/libs", ] }, "ios": { "useFrameworks": "static" } } ], ["@react-native-firebase/app",], ["@react-native-firebase/messaging"],

But compiler said same issiue:

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:processDebugResources'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available. Searched in the following locations:

  • 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.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 33s 15 actionable tasks: 15 up-to-date Error: /home/emmanuel/Documentos/ttk-responsiveIOS/android/gradlew exited with non-zero code: 1 Error: /home/emmanuel/Documentos/ttk-responsiveIOS/android/gradlew exited with non-zero code: 1 at ChildProcess.completionListener (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23) at Object.onceWrapper (node:events:628:26) at ChildProcess.emit (node:events:513:28) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at Object.spawnAsync [as default] (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21) at spawnGradleAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46) at Object.assembleAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18) at runAndroidAsync (/home/emmanuel/Documentos/ttk-responsiveIOS/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24)

i running my project in version 49.0.16 of expo. But i don't find any solution of this issie.

I'm getting the same error, were you able to solve it? I tried adding build properties to the plugin section as well, but it didn't work.

anubisdark commented 5 months ago

Finally i migrated all component to firebase messaging, because i don't get any solution for this.

hanselsen commented 4 months ago

This is a very hard issue to tackle. I had it and fixed it, but after upgrading Expo to 51, it is back. I have added the expo-build-properties plugin with the extraMavenRepos property. I even tried to add the repo in build.gradle:

maven {
    url(new File("../../node_modules/@notifee/react-native/android/libs"))
}

Still no luck.

maxim-cpg commented 1 month ago

This is a very hard issue to tackle. I had it and fixed it, but after upgrading Expo to 51, it is back. I have added the expo-build-properties plugin with the extraMavenRepos property. I even tried to add the repo in build.gradle:

maven {
    url(new File("../../node_modules/@notifee/react-native/android/libs"))
}

Still no luck.

same problem here with expo 51

fabiiomariiano commented 3 weeks ago

this worked for me.

npx expo install expo-build-properties


  "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "extraMavenRepos": [
              "../../node_modules/@notifee/react-native/android/libs"
              ]
          },
          "ios": {  }
        }
      ],
      "@react-native-firebase/app",
      "@react-native-firebase/messaging"
    ],

This worked for me. I used the exact path to node_modules as described. Physically, my app.json file is in the same folder as node_modules, but using the logical path ./node_modules/@notifee/react-native/android/libs didn't work. It only worked with the relative path "../../node_modules/...". Thanks!

mikehardy commented 3 weeks ago

@fabiiomariiano that is because the path is used in an android build system context, that is the path is added to the android app build file and used while gradle is executing from directory context android/app, such that android/app/../../node_modules/@notifee/react-native/android/libs makes sense

NorseGaud commented 1 week ago

Be sure to run npx expo prebuild --clean after applying the proposed changes or else the new android (native) files aren't created properly.