skip to Main Content

I install Notifee package using yarn,

yarn add @notifee/react-native

After I run it,

yarn start
yarn run android

Throws an error like this,

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':notifee_react-native:compileDebugJavaWithJavac'.

I’m struggling to implement notifications in my React Native project. Really appreciate it if somebody could help me. Thanks.

3

Answers


  1. Chosen as BEST ANSWER

    As in v 6.0.0 added Android 13 support the compiledSdkVersion and targetSdkVersion should be changed to 33.

    In your project android/build.gradle change,

    compileSdkVersion = 33
    targetSdkVersion = 33
    

    More reference, https://www.youtube.com/watch?v=Fxzi8Ug9NUA&ab_channel=CodewithMishen


  2. In case if someone doesn’t want to change the compileSdkVersion (maybe because other library will have compileDebugJavaWithJavac error) then they can try:

    npm install --save @notifee/[email protected]
    

    and keep the compileSdkVersion the same as before

    Login or Signup to reply.
  3. Add this in the allprojects area of your android/buld.gradle file.

    def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
    
    allprojects {
        configurations.all {
            resolutionStrategy {
                // Remove this override in 0.65+, as a proper fix is included in react-native itself.
                force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
            }
        }
    

    https://github.com/facebook/react-native/issues/35210

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search