Search code examples
androidreact-nativefbsdkreact-native-fbsdk

React-Native unable to build project


I'm trying to implement the FB Auth and followed everything mentioned in FBSDK . React-native: 0.47.1 and FBSDK: 0.6.1 . After I did that, the project wont build. Getting error:

error: method does not override or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

enter image description here

I checked that the MainApplication.java and MainActivity.java and have copied everything as mentioned in github page. I also ran react-native link react-native-fbsdk after i installed react-native-fbsdk. I restarted the laptop to be sure to have reset the gradle or anything cause its a windows laptop. I'm not sure why it's giving this error.

Please help. Many thanks.

After removing the following from node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java

@Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

I tried to build the project again and getting error:

enter image description here


Solution

  • It appears to be a commun issue for react native 0.47 https://github.com/facebook/react-native-fbsdk/pull/354 and the fix is not released yet.

    What you can do waiting for the next release is to go to the file :

    node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java

    and remove the method and the @Override who cause this error line 61 to 64.

    @Override
        public List<Class<? extends JavaScriptModule>> createJSModules() {
            return Collections.emptyList();
        }
    

    Then rebuild your app