Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Build failing in RN 0.59.8 #686

Closed
Udbhav12 opened this issue Jun 3, 2019 · 21 comments
Closed

Android Build failing in RN 0.59.8 #686

Udbhav12 opened this issue Jun 3, 2019 · 21 comments

Comments

@Udbhav12
Copy link

Udbhav12 commented Jun 3, 2019

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.

@stanislav-halyn
Copy link

The same problem.

@hardikfareye
Copy link

I am facing the same problem

@niteshsingh0129
Copy link

The same problem !!

@rahul-algorithmgeek
Copy link

Yes Its an issue.

@quantb95
Copy link

quantb95 commented Jun 5, 2019

Same problem . Anyone fix ?

@brendanosborne
Copy link

Same.

@Frank-vdm
Copy link

Same here

@OliveIT
Copy link

OliveIT commented Jun 5, 2019

I have that problem when I use
react-native@0.59.4
react-native-camera@2.10.0
react-native-fs@2.13.3
react-native-gesture-handler@1.1.0

I installed react-native-camera@2.9.0
And added this in android/app/build.gradle

android {
...
defaultConfig {
...
missingDimensionStrategy 'react-native-camera', 'general'
}
}

It is solved.

@bthuan
Copy link

bthuan commented Jun 5, 2019

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.

@Udbhav12
Copy link
Author

Udbhav12 commented Jun 7, 2019

@bthuan Thanks man! Upgrading to 0.59.9 seems to somehow fix this bug

@Udbhav12 Udbhav12 closed this as completed Jun 7, 2019
@maieonbrix
Copy link

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

@maieonbrix
Copy link

maieonbrix commented Jun 18, 2019

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 : facebook/react-native#25294
It was due to an AndroidManifest.xml file not being fully complete. I had to add this : facebook/react-native#25294 (comment)

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')

@jgreen01su
Copy link
Contributor

@maieonbrix Great! Thank you for the detailed explanation! I'm also having this issue after updating to 0.59.9. I'll probably be doing the same with some of dependencies. Could you create a PR for the change you made? That way others can pull your update.

React Native is migrating to androidx and all packages will need to make the change.
react-native-community/discussions-and-proposals#129

jgreen01su added a commit to jgreen01su/react-native-fs that referenced this issue Jun 18, 2019
- Replace `android.support.annotation.Nullable` with 
`androidx.annotation.Nullable` import.
- Thanks to @maieonbrix hard work finding this fix. 
(itinance#686 (comment))
@jgreen01su
Copy link
Contributor

@maieonbrix I created a PR. Let me know if you'd like me to take it down so you can submit your own.
#691

@yusuf987
Copy link

yusuf987 commented Jun 23, 2019

thanks @maieonbrix your solution worked for me

i am also struggling with androidx update thing. till now
can you help me with

do have to update all node packages like react-native-fcm, react-native-fc...etc ???

i want a simple solution

@maieonbrix
Copy link

I think you need indeed to update each of your packages, the simplest solution right now is just to delete the import and the annotation since it is just an annotation. told by @mikehardy here : #691 (comment)

@darsodango
Copy link

darsodango commented Jul 10, 2019

@maieonbrix I tried doing your method and it's still throwing an RNFSManager.java uses or overrides a deprecated API

btw, my react-native version is 0.60.0 and my react-native-fs is 2.13.3

@maieonbrix
Copy link

maieonbrix commented Jul 10, 2019

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

@wincod75
Copy link

wincod75 commented Nov 18, 2019

Anyone else still getting this error? I've tried all suggested fixes/hacks, nothing is working. I've tried various version of RNFS from "2.13.2" to "2.14.0" and now "2.15.2".

Reads:

"/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details."

"react": "16.6.3",
"react-native": "0.59.2",
"react-native-fs": "2.15.2",

@ghost
Copy link

ghost commented Nov 19, 2019

@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 ?

@ghost
Copy link

ghost commented Apr 11, 2020

I'm getting this error inside a CI/CD application. I can't edit node_modules. Does somebody have any alternative?

@mikehardy
Copy link

@juliojeronimo you need to use jetifier either in forward or reverse mode depending on if you are using AndroidX or trying to remain on the support libraries. It will edit node_modules, if that is a hard constraint you need to talk with the people that made it in order to relax the constraint, as a practical matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests