facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 907 forks source link

error: cannot find symbo import androidx.annotation.Nullable; #600

Closed DerekFei closed 5 years ago

DerekFei commented 5 years ago

After running react-native run-android This happens

node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\FBLoginButtonManager.java:62: error: cannot find symbol
public void setDefaultAudience(RCTLoginButton loginButton, @Nullable String defaultAudience) { ^ symbol: class Nullable location: class FBLoginButtonManager node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\FBLoginButtonManager.java:69: error: cannot find symbol @Nullable ReadableArray publishPermissions) { ^ symbol: class Nullable location: class FBLoginButtonManager \node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\Utility.java:306: error: cannot find symbol public static @Nullable List reactArrayToStringList(@Nullable ReadableArray array) { ^ symbol: class Nullable location: class Utility \node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\Utility.java:306: error: cannot find symbol public static @Nullable List reactArrayToStringList(@Nullable ReadableArray array) { ^ symbol: class Nullable location: class Utility Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\Utility.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details. 12 errors

FAILURE: Build failed with an exception.

mohitbhansali commented 5 years ago

Any solution for above? Facing the same issue.

aricoz commented 5 years ago

Same issue here :(

theyasirahmad commented 5 years ago

in android/gradle.properties add below two line. in my case solve issue using this.

android.useAndroidX=true
android.enableJetifier=true
lomocc commented 5 years ago

https://developer.android.com/jetpack/androidx

arjdev69 commented 5 years ago

in android/gradle.properties add below two line. in my case solve issue using this.

android.useAndroidX=true
android.enableJetifier=true

Thanks

myxit commented 4 years ago

Hi, It looks like I have a similar problem as topic started. I have modified graddle.properties as theyasirahmad suggested, but that did not help.

How to reproduce:

  1. clone the repo
  2. yarn install && yarn run start in example/ folder
  3. in another terminal run npx react-native run-android as a result I get a lot of errors as above:
    ImagePickerModule.java:15: error: package androidx.annotation does not exist
    import androidx.annotation.NonNull;

Any ideas?

dennysjmarquez commented 4 years ago

Genial Funciona 100 Puntos 👍👍 @theyasirahmad Gracias 💪

fandu139 commented 4 years ago

android.useAndroidX=true android.enableJetifier=true

i get an error like this

Task :react-native-gesture-handler:compileDebugJavaWithJavac
/Users/fandupratamalakuana/test-interview/react-native/<my_folder>/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.java:37: error: cannot find symbol
import androidx.annotation.Nullable;

end then this methods its works

luisorduz commented 4 years ago

Add the following two flags to true in your gradle.properties file at ProjectFolder/android/gradle.properties

android.useAndroidX=true android.enableJetifier=true

Execute: npm install --save-dev jetifier npx jetify npx react-native run-android

In your package.json add the following to scripts "postinstall" : "npx jetify"

https://stackoverflow.com/questions/40380519/error-package-com-android-annotations-does-not-exist

mishin commented 4 years ago

add implementation("com.google.code.findbugs:jsr305:3.0.2") to build.gradle.kts