Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native-push-notification can not build in android

Tags:

react-native

I'll be using react-native-push-notification for notifications in my app but when I use this library it gives me error like this.....

> Task :react-native-push-notification:compileDebugJavaWithJavac FAILED
E:\AndroidNotify\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java:7: error: cannot find symbol
import android.app.NotificationChannel;
                  ^
  symbol:   class NotificationChannel
  location: package android.app
E:\AndroidNotify\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java:480: error: cannot find symbol
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
                                                       ^
  symbol:   variable O
  location: class VERSION_CODES
E:\AndroidNotify\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java:488: error: cannot find symbol
        int importance = NotificationManager.IMPORTANCE_DEFAULT;
                                            ^
  symbol:   variable IMPORTANCE_DEFAULT
  location: class NotificationManager
E:\AndroidNotify\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java:489: error: cannot find symbol
        NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
        ^
  symbol:   class NotificationChannel
  location: class RNPushNotificationHelper
E:\AndroidNotify\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java:489: error: cannot find symbol
        NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
                                          ^
  symbol:   class NotificationChannel
  location: class RNPushNotificationHelper
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
like image 894
Akshay I Avatar asked Dec 17 '25 20:12

Akshay I


1 Answers

Try to upgrade on react-native-push-notification/android/build.gradle this dependencies

  • def DEFAULT_COMPILE_SDK_VERSION = 26
  • def DEFAULT_BUILD_TOOLS_VERSION = "26.1.0"
  • def DEFAULT_TARGET_SDK_VERSION = 23
  • def DEFAULT_SUPPORT_LIB_VERSION = "26.1.0"
  • def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "+"
  • def DEFAULT_FIREBASE_MESSAGING_VERSION = "+"

let me know if that helps you

Error whith RNPushNotifications android

like image 63
Helmer Barcos Avatar answered Dec 19 '25 14:12

Helmer Barcos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!