react-native-fbsdk 0.8.0 包 com.facebook.reactnative.androidsdk 不存在

react-native-fbsdk 0.8.0 package com.facebook.reactnative.androidsdk does not exist

我尝试将 react-native-fbsdk 从 0.7.0 升级到 0.8.0,但 react-native 运行-android 命令不再起作用。

: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

这就是我想升级到这个版本的原因:

我注意到,node_modules/react-native-fbsdk/android 中没有构建目录。

使用的react-native版本:react-native@0.57.3

有人可以帮我吗?

官方错误报告帮助我解决了这个问题:https://developers.facebook.com/support/bugs/260814197942050/?disable_redirect=0

复制粘贴上面 link 的分辨率 - 您需要将其添加到 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
                        }
                }
        }
}