在安装fbsdk库并按照所有步骤正确链接它之后,我在使用react(本机运行)构建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发布于 2018-01-31 17:45:12
好的,我设法修复了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很重要。
发布于 2018-10-26 09:18:17
我通过将fbsdk更新到0.8.0来解决这个问题
react-native install react-native-fbsdk@0.8.0
注:这将链接到图书馆。它可能会导致相应文件中的双重条目,您必须手动删除这些条目。
发布于 2018-10-31 12:40:46
在node_modules/react-native-fbsdk/android/build.gradle上将的版本更改为4.37.0
compile 'com.facebook.android:facebook-android-sdk:4.37.0'https://stackoverflow.com/questions/48546467
复制相似问题