1

I've tried to upgrade the react-native-fbsdk from 0.7.0 to 0.8.0 but the react-native run-android command does not working anymore.

:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). C:\Dev\react-native\imnews\android\app\src\main\java\com\imnews\MainApplication.java:10: error: package com.facebook.reactnative.androidsdk does not exist import com.facebook.reactnative.androidsdk.FBSDKPackage; ^ C:\Dev\react-native\imnews\android\app\src\main\java\com\imnews\MainApplication.java:43: error: cannot find symbol new FBSDKPackage(mCallbackManager), ^ symbol: class FBSDKPackage

This is the reason why I'd like to upgrade to this version: Ios version of app works, but Android fails due to no suitable constructor found for AccessToken for React Native App

I've noticed, there is no build directory in node_modules/react-native-fbsdk/android.

Used react-native version: react-native@0.57.3

Could somebody help me please?

lacoo2004
  • 13
  • 2

1 Answers1

0

The official bug report helped me to fix this issue: https://developers.facebook.com/support/bugs/260814197942050/?disable_redirect=0

copy-pasted the resolution from the link above - you need to add this to android/build.gradle:

def versionOverrides = [
        "com.facebook.android:facebook-android-sdk": "4.37.0",
]

allprojects {
        repositories {
                ...
        }
        configurations.all {
                resolutionStrategy.eachDependency { DependencyResolveDetails details ->
                        def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]

                        if (overrideVersion != null && details.requested.version != overrideVersion) {
                                details.useVersion overrideVersion
                        }
                }
        }
}
Adam Ivancza
  • 2,459
  • 1
  • 25
  • 36
  • Thank you very much. It's working for me but olny with react-native-fbsdk@0.7.0. So it can't resolve the "com.facebook.reactnative.androidsdk does not exist" issue in case of 0.8.0 version, but the original issue was resolved. So thanks a lot. – lacoo2004 Oct 29 '18 at 23:19