React native fbsdk issue - Task :react-native-fbsdk:compileDebugJavaWithJavac FAILED
Asked Answered
S

3

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
Stringhalt answered 31/1, 2018 at 16:4 Comment(2)
Do cd android && ./gradlew clean yarn add react-native-fbsdk . Make sure you are connected with device or Emulator .Nubble
@SyedZainAli Thanks but doesnt work, still getting same error message.Stringhalt
S
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.

Stringhalt answered 31/1, 2018 at 17:45 Comment(4)
Whats yours Other Issue .Nubble
@SyedZainAli I had an issue with my build.graddle file and google play related stuff but I managed to fix it and I can run my app now. ThanksStringhalt
Already have that code in my build.gradle. Still have this issue.Dramatics
i have already this code in my build.graddle anyone has a clue ?Domash
B
4

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.

Baby answered 26/10, 2018 at 9:18 Comment(1)
I'm using "react-native-fbsdk": "^0.8.0" and I have the gradle config as suggested by @Stringhalt before visiting this page. So, for me, this is not the solution. If I find it, I will post here.Dramatics
S
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.

Stringhalt answered 31/1, 2018 at 17:45 Comment(4)
Whats yours Other Issue .Nubble
@SyedZainAli I had an issue with my build.graddle file and google play related stuff but I managed to fix it and I can run my app now. ThanksStringhalt
Already have that code in my build.gradle. Still have this issue.Dramatics
i have already this code in my build.graddle anyone has a clue ?Domash
G
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

Geranial answered 31/10, 2018 at 12:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.