在安装fbsdk库并按照所有步骤正确链接后,我在使用react-native run-android构建我的android文件夹时出现问题。以下是我的错误消息。
我已经尝试将默认的sdk版本从23更改为27.0.1,这样我就可以获得更详细的错误消息,因为之前我只能构建aapp。
知道怎么解决这个问题吗?它适用于ios。
> Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED
/Users/hugohyz/code/hugoh1995/dogtime_react/DogtimeReactInit/node_modules/react-native-fbsdk/android/src/main/java/com/facebook/reactnative/androidsdk/FBAppEventsLoggerModule.java:209: error: cannot find symbol
@ReactMethod(isBlockingSynchronousMethod = true)
^
symbol: method isBlockingSynchronousMethod()
location: @interface ReactMethod
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/hugohyz/code/hugoh1995/dogtime_react/DogtimeReactInit/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.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-fbsdk:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
76 actionable tasks: 1 executed, 75 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
答案 0 :(得分:4)
我通过将fbsdk更新为0.8.0来解决了该问题
react-native install react-native-fbsdk@0.8.0
注意:这将链接库。这可能会导致相应文件中出现双重条目,您必须手动删除它们。
答案 1 :(得分:1)
好的,所以我设法修复了与fbsdk相关的问题。显然我在 android / build.graddle
中缺少以下代码allprojects {
repositories {
...
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
...
我现在面临另一个问题,所以我将打开另一个主题。
显然,在将新maven添加到存储库时,不要替换现有的maven。
答案 2 :(得分:0)
在node_modules / react-native-fbsdk / android / build.gradle上将您的facebook-android-sdk版本更改为4.37.0
compile 'com.facebook.android:facebook-android-sdk:4.37.0'