react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Task :react-native-push-notification:compileDebugJavaWithJavac FAILED all of a sudden

Open Helen2hang opened this issue 5 years ago • 74 comments

Bug

Two projects that uses this library. But suddenly we can't build them on Android anymore. Task :react-native-push-notification:compileDebugJavaWithJavac FAILED

It seems like other people are having this issue too. But it might be related to react-native-fcm. https://github.com/evollu/react-native-fcm/issues/1111#issuecomment-839178980 Anyone know how to fix it?

Environment info

react-native info output:


System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 82.62 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.8.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6858069
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 15.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.4 => 0.63.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 7.2.3

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.3/userguide/command_line_interface.html#sec:command_line_warnings
148 actionable tasks: 146 executed, 2 up-to-date
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/helenzhang/projects/akufen_icc_react-native/node_modules/react-native-background-downloader/android/src/main/java/com/eko/RNBackgroundDownloaderModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/helenzhang/projects/akufen_icc_react-native/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/helenzhang/projects/akufen_icc_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.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
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.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: /Users/helenzhang/projects/akufen_icc_react-native/node_modules/react-native-localize/android/src/main/java/com/reactcommunity/rnlocalize/RNLocalizeModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
/Users/helenzhang/projects/akufen_icc_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
/Users/helenzhang/projects/akufen_icc_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
/Users/helenzhang/projects/akufen_icc_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
/Users/helenzhang/projects/akufen_icc_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
/Users/helenzhang/projects/akufen_icc_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
/Users/helenzhang/projects/akufen_icc_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: /Users/helenzhang/projects/akufen_icc_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: /Users/helenzhang/projects/akufen_icc_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
3 warnings

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.

Steps To Reproduce

  1. npx react-native run-android

Describe what you expected to happen:

  1. App should build successfully on Android

Reproducible sample code

Helen2hang avatar May 11 '21 22:05 Helen2hang

Getting the exact same errors. I built probably 50 times with no issue, and then suddenly on multiple build machines this error started occurring. Suspect not specifically in this library but a low-level dependency that was pushed.

jeffbonasso-ambifi avatar May 11 '21 22:05 jeffbonasso-ambifi

I'm getting the same error, it started about an hour ago out of nowhere

catherinekorres avatar May 11 '21 22:05 catherinekorres

Getting the same error here.

lourencorodrigo avatar May 11 '21 22:05 lourencorodrigo

Try to add implementation com.google.firebase:firebase-messaging:21.1.0 to app/build.gradle and firebaseMessagingVersion=21.1.0 to gradle.properties. Worked for me

nikolaywithpara avatar May 11 '21 22:05 nikolaywithpara

Try to add implementation com.google.firebase:firebase-messaging:21.1.0 to app/build.gradle and firebaseMessagingVersion=21.1.0 to gradle.properties. Worked for me

This worked for me! Thank you @nikolaywithpara! Do you know what could cause this? maybe an old firebase-messaging that would make some kind of conflict with some package used version?

taltrui avatar May 11 '21 22:05 taltrui

@taltrui I think none of us has fixed firebase messaging package version and firebase did new release with breaking changes

nikolaywithpara avatar May 11 '21 22:05 nikolaywithpara

/App/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:268: error: cannot find symbol
                  FirebaseInstanceId.getInstance().deleteInstanceId();
                  ^
  symbol: variable FirebaseInstanceId
Note: /App/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.
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.


Is this the same error everyone facing ?

all of a sudden react-native run-android is failing due to this

mir1198yusuf avatar May 11 '21 22:05 mir1198yusuf

Thanks @nikolaywithpara! Worked perfect. You can also add firebaseMessagingVersion in android/build.gradle along with other library versions instead of gradle.properties:

ext {
        firebaseMessagingVersion = "21.1.0"
        googlePlayServicesLocationVersion = "17.0.0"
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
        supportLibVersion = "28.0.0"
}

jeffbonasso-ambifi avatar May 11 '21 22:05 jeffbonasso-ambifi

All Trace

/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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
/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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
/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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
/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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
/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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
/Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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: /Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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: /Users/emrecanozkok/Documents/workspace/projects/react-native-a11/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.

emrecanozkok avatar May 11 '21 22:05 emrecanozkok

@emrecanozkok try this solution work for me

ext {
        firebaseMessagingVersion = "21.1.0" // Add this is android/build.gradle
        
}

iamamar11 avatar May 11 '21 22:05 iamamar11

@emrecanozkok try this solution work for me

`ext { firebaseMessagingVersion = "21.1.0" // Add this is app/build.gradle

}`

is it android/build.gradle ?

emrecanozkok avatar May 11 '21 22:05 emrecanozkok

@emrecanozkok try this solution work for me ext { firebaseMessagingVersion = "21.1.0" // Add this is app/build.gradle }

is it android/build.gradle ?

android/build.gradle

iamamar11 avatar May 11 '21 22:05 iamamar11

@emrecanozkok try this solution work for me ext { firebaseMessagingVersion = "21.1.0" // Add this is app/build.gradle }

is it android/build.gradle ?

android/build.gradle

You are save my hours bro.thank you. i tried before "+" or my version but didnt work. but now its compiled and im testing my critical app update.

emrecanozkok avatar May 11 '21 22:05 emrecanozkok

or my version but didnt work. but now its compiled and im testing my critical app update.

Awesome! same thing I did on my end.

iamamar11 avatar May 11 '21 22:05 iamamar11

Worked for me as well the error was https://github.com/zo0r/react-native-push-notification/issues/1979#issuecomment-839238854 the solution is https://github.com/zo0r/react-native-push-notification/issues/1979#issuecomment-839254700

mir1198yusuf avatar May 12 '21 00:05 mir1198yusuf

Try to add implementation com.google.firebase:firebase-messaging:21.1.0 to app/build.gradle and firebaseMessagingVersion=21.1.0 to gradle.properties. Worked for me

It worked for me!! Thanks!

Lucasdsk avatar May 12 '21 00:05 Lucasdsk

@emrecanozkok try this solution work for me

ext {
        firebaseMessagingVersion = "21.1.0" // Add this is android/build.gradle
        
}

It's working to run application on device, but I'm not able to receive any push notification.

"@react-native-firebase/app": "^8.4.1",
"@react-native-firebase/messaging": "^7.8.4",
"firebase": "^8.2.10",

iamamar11 avatar May 12 '21 01:05 iamamar11

Try to add implementation com.google.firebase:firebase-messaging:21.1.0 to app/build.gradle and firebaseMessagingVersion=21.1.0 to gradle.properties. Worked for me

this solution worked for me Thanks

ThuThuAung avatar May 12 '21 02:05 ThuThuAung

firebaseMessagingVersion=21.1.0

this work for me as well

Thanks!

co2nut avatar May 12 '21 05:05 co2nut

i am getting the same error suddenly

kaneki666 avatar May 12 '21 06:05 kaneki666