react-native-fs: Android Build failing in RN 0.59.8

RNFS Version : 2.13.3

RN Version : 0.59.8

I recently upgraded RN version to 0.59.8 and react-native-run-android command fails

I am getting the below error message

/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java:11: error: package android.support.annotation does not exist import android.support.annotation.Nullable; ^ /Users/udbhavgoyal/Desktop/codebase/fareye-react/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java:624: error: cannot find symbol private void sendEvent(ReactContext reactContext, String eventName, @Nullable WritableMap params) { ^ symbol: class Nullable location: class RNFSManager Note: /Users/udbhavgoyal/Desktop/codebase/fareye-react/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 19
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Can we re-open this issue ? Upgrading to 0.59.9 didn’t help me at all …

After struggling like crazy all day long, I finally found a solution and unfortunately it is not the one provided in this issue.

Basically I started having this issue after the androidx update thing.

At first I was having issues found on the main repo like this one : https://github.com/facebook/react-native/issues/25294 It was due to an AndroidManifest.xml file not being fully complete. I had to add this : https://github.com/facebook/react-native/issues/25294#issuecomment-503021597

Then the react-native-fs thing pops up that led me here, after trying to downgrade / upgrade in every react-native version I decided to tackle the problem at the source : if the .NonNull symbol was not found, let’s find why but then this led to randomly trying package names till I found the .annotation prop which I found on the androidx package.

Then I removed the import android.support.annotation.Nullable; L11 from RNFSManager.java file and replaced it with : import androidx.annotation.Nullable; (this symbol was not greyed out / red like the previous one).

And then the error disappeared for the react-native-fs package but appeared on several other non-related packages which I managed to fix by doing the same thing.

Hope it helps someone.

EDIT :

Or simply delete all of the annotation found in your packages and it will works (delete the import NonNull/Nullable and where it is used (‘@\NonNull’ / ‘@\Nullable’)

@darsodango you need to remove both the imports and the annotation here : https://github.com/itinance/react-native-fs/blob/v2.13.3/android/src/main/java/com/rnfs/RNFSManager.java#L624 (delete both import android.support.annotation.Nullable; and the @Nullable).

If this doesn’t work then it’s a new issue so open a new one, copy past the full error and I’ll gladly try to help.

i am facing an issue something like that but cann’t find solution .Can you help me out ?

@darsodango you need to remove both the imports and the annotation here : https://github.com/itinance/react-native-fs/blob/v2.13.3/android/src/main/java/com/rnfs/RNFSManager.java#L624 (delete both import android.support.annotation.Nullable; and the @Nullable).

If this doesn’t work then it’s a new issue so open a new one, copy past the full error and I’ll gladly try to help.

@maieonbrix I created a PR. Let me know if you’d like me to take it down so you can submit your own. https://github.com/itinance/react-native-fs/pull/691

FYI, I have the same problem with RN 0.59.8, then i upgrade to 0.59.9 ( they just released 7 hour ago at the time i wrote this post) and the error is gone.