Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native fbsdk issue - Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED

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
like image 241
Hugo Avatar asked Jan 31 '18 16:01

Hugo


2 Answers

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.

like image 41
Hugo Avatar answered Oct 24 '22 23:10

Hugo


I solved it by updating fbsdk to 0.8.0

react-native install [email protected]

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

like image 115
Siraj Alam Avatar answered Oct 24 '22 23:10

Siraj Alam