wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 764 forks source link

Task :react-native-notifications:compileReactNative60DebugJavaWithJavac FAILED #851

Closed rexcode closed 2 years ago

rexcode commented 2 years ago

I am getting following error while building debbug apk after installing package and making all android specific changes -

error: cannot find symbol return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R && appContext.getApplicationInfo().targetSdkVersion >= 31; ^ symbol: variable R location: class VERSION_CODES

my package.json

"dependencies": { "@react-native-community/async-storage": "1.7.1", "@react-native-community/datetimepicker": "^3.5.2", "@react-native-community/geolocation": "^2.0.2", "@react-native-community/masked-view": "^0.1.6", "@react-native-community/netinfo": "^6.0.0", "@react-native-community/push-notification-ios": "^1.8.0", "@react-native-community/toolbar-android": "0.1.0-rc.2", "@react-native-firebase/analytics": "^14.5.0", "@react-native-firebase/app": "^14.5.0", "@react-native-firebase/crashlytics": "^14.5.0", "@react-native-firebase/messaging": "^14.5.0", "@react-native-picker/picker": "^1.16.1", "axios": "^0.21.1", "moment": "^2.29.1", "native-base": "^2.15.2", "react": "16.9.0", "react-native": "0.63.0", "react-native-android-location-services-dialog-box": "^2.8.2", "react-native-autogrow-textinput": "^5.3.0", "react-native-awesome-alerts": "^1.3.0", "react-native-background-timer": "^2.4.1", "react-native-connectycube": "^3.7.5", "react-native-device-info": "^5.5.1", "react-native-elements": "^3.4.1", "react-native-fast-image": "^7.0.2", "react-native-geocoding": "^0.5.0", "react-native-gesture-handler": "^1.5.5", "react-native-image-crop-picker": "^0.36.2", "react-native-image-zoom-viewer": "^2.2.27", "react-native-incall-manager": "3.2.7", "react-native-maps": "^0.28.0", "react-native-maps-directions": "^1.8.0", "react-native-material-menu": "^1.2.0", "react-native-notifications": "^4.2.4", "react-native-paper": "^4.8.1", "react-native-picker-select": "^8.0.4", "react-native-push-notification": "^3.1.9", "react-native-reanimated": "^1.7.0", "react-native-responsive-fontsize": "^0.5.0", "react-native-restart": "0.0.22", "react-native-safe-area-context": "^0.6.4", "react-native-screens": "^2.0.0-beta.1", "react-native-simple-toast": "^1.0.0", "react-native-sound": "^0.11.0", "react-native-sound-player": "^0.10.9", "react-native-vector-icons": "6.6.0", "react-native-webview": "^11.6.2", "react-navigation": "^4.0.10", "react-navigation-stack": "^2.0.16", "react-redux": "^7.1.0", "redux": "^4.0.1", "rn-prompt": "^1.0.4", "validate.js": "^0.13.1" },

vladlenskiy commented 2 years ago

same issue

DaveLomber commented 2 years ago

probably need to set target SDK in grade file to 31

abuzzell commented 2 years ago

+1

bernatbombi commented 2 years ago

+1

MarlonAEC commented 2 years ago

Same issue for me here is my log maybe it could help: > Task :react-native-notifications:compileReactNative60DebugJavaWithJavac FAILED .../node_modules/react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/fcm/FcmToken.java:75: error: cannot find symbol FirebaseMessaging.getInstance().getToken() ^ symbol: method getToken() location: class FirebaseMessaging Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error Gradle: 6.9 Kotlin: 1.4.20 Groovy: 2.5.12 Java: 14.0.2 react-native-notifications: 4.3.1 compileSdkVersion = 31 buildToolsVersion = "30.0.2" targetSdkVersion = 31

hope this give more info to solve this issue. Thanks in advance!

AhmadNaeemK commented 2 years ago

Having the same issue.

blessed-tawanda commented 2 years ago

Im getting the same issue Screenshot 2022-07-12 194340

IgorKhomenko commented 2 years ago

Setting target SDK to 31 in gradle file helped me

macasfaj commented 2 years ago

Same issue here :(

buildToolsVersion = "29.0.2" minSdkVersion = 21 compileSdkVersion = 29 targetSdkVersion = 31 supportLibVersion = "27.1.1" googlePlayServicesAuthVersion = "19.2.0"

macasfaj commented 2 years ago

using this and it's not working.

   ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 31  
        targetSdkVersion = 30
        supportLibVersion = "27.1.1"
        googlePlayServicesAuthVersion = "19.2.0"
        firebaseMessagingVersion = '21.1.0'
    }

I get:

 error: cannot find symbol
        return mReactContext.hasActiveReactInstance();

Any idea?

macasfaj commented 2 years ago

I fixed it using this fork!! :)

https://github.com/escolaemmovimento/react-native-notifications/commit/f677b585612eda0559fb9f5eeb773f6c77ea6b49

camboYY commented 2 years ago

I fixed it using this fork!! :)

escolaemmovimento@f677b58

not work for me

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 2 years ago

The issue has been closed for inactivity.

dev-rajshekhar commented 1 year ago

I am getting the same issue:

rn version: 0.64
react-native-notifications : 4:3:3
targetSdk version :31

cannot find symbol return mReactContext.hasActiveReactInstance(); ^ symbol: method hasActiveReactInstance() location: variable mReactContext of type ReactContext

jtovarto commented 1 year ago

I hope it's useful for someone.

I am working with RN 63.5 and react-native-notification@4.1.1 and I get this problem. Looking through the releases, I found an update to RN at the 4.2.0 tag, specifically for a 0.66 version of RN. So my fix for this was to set patch versions, changing from "^4.1.1" to "~4.1.1" (of course you can use a specific version if you want), it will work fine if you are working with react native version prior to v0.66.

bilalyaqoob commented 1 year ago

same issue.