react-nativereact-reduxreact-native-push-notification

react-native-push-notification issue on building app


Can someone help me.I am now Currently working on an app and it works on my few hours but now i have an error message. i also tried updating the EXT{} on different version

"react": "16.13.1",
"react-native": "0.63.2",
 "react-native-push-notification": "^7.2.3",
        ext {
                   googlePlayServicesVersion = "+" // default: "+"
                firebaseMessagingVersion = "+" // default: "+"
                buildToolsVersion = "28.0.3"
                minSdkVersion = 16
                compileSdkVersion = 29
                targetSdkVersion = 29
                 supportLibVersion = "23.1.1"
            }
     dependencies {
            classpath("com.android.tools.build:gradle:3.5.3")
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }

and i tried

  1. ./gradlew assembleRelease --warning-mode all
  2. ./gradlew :app:bundleRelease
  3. ./gradlew clean
  4. and also deleting the node_modules and installing again

but it is still the same

here is the error:

> Task :react-native-push-notification:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
118 actionable tasks: 109 executed, 9 up-to-date
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerManager.java uses or overrides 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.
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-bluetooth-escpos-printer\android\src\main\java\cn\jystudio\bluetooth\tsc\TscCommand.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
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.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-fs\android\src\main\java\com\rnfs\RNFSManager.java uses or overrides 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.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:39: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceId;
                              ^
  symbol:   class FirebaseInstanceId
  location: package com.google.firebase.iid
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:40: error: cannot find symbol
import com.google.firebase.iid.InstanceIdResult;
                              ^
  symbol:   class InstanceIdResult
  location: package com.google.firebase.iid
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:143: error: cannot find symbol
              .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
                                                            ^
  symbol:   class InstanceIdResult
  location: class RNPushNotification
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:145: error: cannot find symbol
                  public void onComplete(@NonNull Task<InstanceIdResult> task) {
                                                       ^
  symbol: class InstanceIdResult
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:142: error: cannot find symbol
      FirebaseInstanceId.getInstance().getInstanceId()
      ^
  symbol:   variable FirebaseInstanceId
  location: class RNPushNotification
C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:289: error: cannot find symbol
                  FirebaseInstanceId.getInstance().deleteInstanceId();
                  ^
  symbol: variable FirebaseInstanceId
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-push-notification:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

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

* Get more help at https://help.gradle.org

BUILD FAILED in 59s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\SBPC\offline_hotel\new\staff\realm-tutorial-react-native\node_modules\@react-native-picker\picker\android\src\main\java\com\reactnativecommunity\picker\ReactPickerManager.java uses or overrides a deprecated API.

Solution

  • Seems this is an issue affecting a lot of developers recently. Me too faced the same issue. The following solutions worked for me.

    1. Change react-native-push-notification version to ^7.3.0. This solved the build issue in one of my project.

    OR

    1. Do the below mentioned changes.

    In android/app/build.gradle, add the below code to dependencies:

    implementation 'com.google.firebase:firebase-messaging:21.1.0'

    In android/build.gradle, make the below changes:

    buildscript {
      ext {
        buildToolsVersion = "28.0.3"
        ...rest of your code
      }
      ...rest of your code
    }
    

    This also worked for me in yet another project. Give both a shot and mention if any of these worked out for you!