我试图将react-native-fbsdk从0.7.0升级到0.8.0,但是react-native run-android命令不再起作用。
:app:compileDebugJavaWithJavac-不是增量的(例如,输出已更改,之前没有执行等)。 C:\ Dev \ react-native \ imnews \ android \ app \ src \ main \ java \ com \ imnews \ MainApplication.java:10:错误:包com.facebook.reactnative.androidsdk不存在 导入com.facebook.reactnative.androidsdk.FBSDKPackage; ^ C:\ Dev \ react-native \ imnews \ android \ app \ src \ main \ java \ com \ imnews \ MainApplication.java:43:错误:找不到符号 新的FBSDKPackage(mCallbackManager), ^ 符号:FBSDKPackage类
这就是我要升级到此版本的原因: Ios version of app works, but Android fails due to no suitable constructor found for AccessToken for React Native App
我注意到,node_modules / react-native-fbsdk / android中没有构建目录。
使用的本机版本:react-native@0.57.3
有人可以帮我吗?
答案 0 :(得分:0)
官方错误报告帮助我解决了此问题:https://developers.facebook.com/support/bugs/260814197942050/?disable_redirect=0
从上面的链接复制粘贴分辨率-您需要将其添加到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
}
}
}
}