7

I'm having issues building my android folder with react-native run-android after installing the fbsdk library and following all the steps to properly link it. Below is my error message.

I already tried to change my default sdk version from 23 to 27.0.1 which allowed me to have a more detailed error message since before I would only get failed to build aapp.

Any idea how to fix this? It works properly on 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
Hugo
  • 2,073
  • 6
  • 23
  • 46

3 Answers3

4

I solved it by updating fbsdk to 0.8.0

react-native install react-native-fbsdk@0.8.0

Note: This will link the library. It may cause dual entries in your corresponding files, which you have to remove manually.

Siraj Alam
  • 9,217
  • 9
  • 53
  • 65
  • 2
    I'm using `"react-native-fbsdk": "^0.8.0"` and I have the gradle config as suggested by @Hugo before visiting this page. So, for me, this is not the solution. If I find it, I will post here. – Mike S. Jan 18 '19 at 19:13
1

Ok so I managed to fix the fbsdk related issue. Apparently I was missing the following code inside 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"
        }
      ...

I'm now faced with another issue tho so I'll open another thread.

It's important not to replace existing maven when adding new maven to the repositories apparently.

Hugo
  • 2,073
  • 6
  • 23
  • 46
0

Change your version of facebook-android-sdk to 4.37.0 on node_modules/react-native-fbsdk/android/build.gradle

compile 'com.facebook.android:facebook-android-sdk:4.37.0'

react-native-fbsdk error can't run react-native run-android