反应本机fbsdk问题 - 任务:react-native-fbsdk:compileDebugJavaWithJavac FAILED

Hug*_*ugo 6 android android-studio reactjs react-native fbsdk

在安装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
Run Code Online (Sandbox Code Playgroud)

Hug*_*ugo 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"
        }
      ...
Run Code Online (Sandbox Code Playgroud)

我现在面临另一个问题,所以我将打开另一个线程。

显然,在向存储库添加新的 Maven 时,不要替换现有的 Maven,这一点很重要。