Coder Social home page Coder Social logo

[SOLVED: use react-native 0.63+ or patch locally] react-native-fbsdk-next:compileDebugJavaWithJavac about react-native-fbsdk-next HOT 26 CLOSED

thebergamo avatar thebergamo commented on June 25, 2024 2
[SOLVED: use react-native 0.63+ or patch locally] react-native-fbsdk-next:compileDebugJavaWithJavac

from react-native-fbsdk-next.

Comments (26)

rukmanary avatar rukmanary commented on June 25, 2024 5

I think I solved this with Android Studio help because I'm not so familiar with Java...

In node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBProfileModule.java there's no constructor. And as Android Studio suggestion, I click one of it's options (just like eslint fix) and this code is automatically generated:

    public FBProfileModule(@NonNull ReactApplicationContext reactContext) {
        super(reactContext);
    }

Then in node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java in createNativeModules function:

new FBProfileModule() is not passing anything.

So, I pass reactContext to it:
new FBProfileModule(reactContext)

is this really how to solved it? Or I am doing it wrong but it still works?

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 4

You should update to at least react native 0.63 I think? 62 has no official support for the base react native framework since xcode 12.5 came out

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 3

@ts-amir-shaikh alternative method is to fix yourself locally until you can update to a modern react-native version - patch-package is the thing everyone uses for this - apply the patch locally and move on: https://github.com/ds300/patch-package

from react-native-fbsdk-next.

rukmanary avatar rukmanary commented on June 25, 2024 3

I think I solved this with Android Studio help because I'm not so familiar with Java...
In node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBProfileModule.java there's no constructor. And as Android Studio suggestion, I click one of it's options (just like eslint fix) and this code is automatically generated:

    public FBProfileModule(@NonNull ReactApplicationContext reactContext) {
        super(reactContext);
    }

Then in node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java in createNativeModules function:
new FBProfileModule() is not passing anything.
So, I pass reactContext to it:
new FBProfileModule(reactContext)
is this really how to solved it? Or I am doing it wrong but it still works?

Only one thing is missing in this which I already recommended in commit review
import com.facebook.react.bridge.ReactApplicationContext;

Yes, I forgot to mention it, import com.facebook.react.bridge.ReactApplicationContext;

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024 2

I also have RN 0.61.5 and would like to use the 4.3.0 library if it fixes issues like mentioned above, but when I tried to install it, npm gave an err saying "unable to resolve dependency tree" since the dependency is >=0.63.3

It says
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

Not sure if it's ok to force something like this... is this how you did it? @ugrdursun
I usually don't run into situations like this so it's the first time for me where there's a dependency conflict that's hard to get around

I guess a better question is - is it safer/better for long term stability to use 4.2.0 and just try to fix the android issue, or use 4.3.0 despite the dependency conflict?

I am using 4.3.0 with 0.61.5 for more than a month and working fine on me. I think dependency conflict is not that deeper to cause any huge problem here.

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 1

I believe 4.3.0 was specifically released to restore compatibility with older RN versions. The document may be out of date. How did it go when you tried it?

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 1

Didn't say you were talking gibberish:

I did not try it

I said "The document may be out of date. " not "you're talking gibberish." You should try it, report results.

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024 1

Didn't say you were talking gibberish:

I did not try it

I said "The document may be out of date. " not "you're talking gibberish." You should try it, report results.

My apologies, you were right! Document needs a correction. It works on both android and iOS perfectly. Sorry I got you wrong. Thanks!

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 1

Fantastic! I was about to be really confused if it did not work actually since it was the point of the change before. But documentation frequently goes out of date, yes. I'll hit the edit button at the top of the page and propose a change to the ranges now that we are compatible again

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024 1

use older npm or --legacy-peer-deps

but really update react-native for long term stability

from react-native-fbsdk-next.

ts-amir-shaikh avatar ts-amir-shaikh commented on June 25, 2024

I think I solved this with Android Studio help because I'm not so familiar with Java...

In node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBProfileModule.java there's no constructor. And as Android Studio suggestion, I click one of it's options (just like eslint fix) and this code is automatically generated:

    public FBProfileModule(@NonNull ReactApplicationContext reactContext) {
        super(reactContext);
    }

Then in node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java in createNativeModules function:

new FBProfileModule() is not passing anything.

So, I pass reactContext to it:
new FBProfileModule(reactContext)

is this really how to solved it? Or I am doing it wrong but it still works?

Only one thing is missing in this which I already recommended in commit review
import com.facebook.react.bridge.ReactApplicationContext;

from react-native-fbsdk-next.

ts-amir-shaikh avatar ts-amir-shaikh commented on June 25, 2024

When can we expect this fix with new release?
It works fine as expected please release this ASAP

from react-native-fbsdk-next.

suchoX avatar suchoX commented on June 25, 2024

Can this please me mentioned in troubleshooting part of Readme?

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024

I made the title prescriptive and pinned it on the repo. At this point effectively no one should be using 0.62 or lower as it literally does not compile with current Xcode, it's broken completely.

from react-native-fbsdk-next.

ts-amir-shaikh avatar ts-amir-shaikh commented on June 25, 2024

@ts-amir-shaikh alternative method is to fix yourself locally until you can update to a modern react-native version - patch-package is the thing everyone uses for this - apply the patch locally and move on: https://github.com/ds300/patch-package

@mikehardy Yes working with the patch for now

from react-native-fbsdk-next.

thebergamo avatar thebergamo commented on June 25, 2024

closing as #31 got merged

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024

@ts-amir-shaikh alternative method is to fix yourself locally until you can update to a modern react-native version - patch-package is the thing everyone uses for this - apply the patch locally and move on: https://github.com/ds300/patch-package

@mikehardy Yes working with the patch for now

How should we apply this patch ? I am not familiar with applying patches

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024

I think I solved this with Android Studio help because I'm not so familiar with Java...

In node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBProfileModule.java there's no constructor. And as Android Studio suggestion, I click one of it's options (just like eslint fix) and this code is automatically generated:

    public FBProfileModule(@NonNull ReactApplicationContext reactContext) {
        super(reactContext);
    }

Then in node_modules/react-native-fbsdk-next/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java in createNativeModules function:

new FBProfileModule() is not passing anything.

So, I pass reactContext to it:
new FBProfileModule(reactContext)

is this really how to solved it? Or I am doing it wrong but it still works?

Hello,

I couldn't apply this because my FBProfileModule.java is not familiar with yours example.

I have this:

`package com.facebook.reactnative.androidsdk;

import com.facebook.Profile;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;

import androidx.annotation.NonNull;

/**
 * This is a {@link NativeModule} that allows JS to use FBSDKProfile info of the current logged user.
 */


@ReactModule(name = FBProfileModule.NAME)
public class FBProfileModule extends ReactContextBaseJavaModule {
    public static final String NAME = "FBProfile";

    @NonNull
    @Override
    public String getName() {
    return NAME;
  }

    /**
    * Get the current logged profile.
    * @param callback Use callback to pass the current logged profile back to JS.
    */
    @ReactMethod
    public void getCurrentProfile(Callback callback) {
        //Return the profile object as a ReactMap.
        callback.invoke(Profile.getCurrentProfile() == null
                ? null
                : Utility.profileToReactMap(Profile.getCurrentProfile()));
  }
}
`

How should i edit this ?

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024

How should i edit this ?

You don't? The fix was merged so it's not necessary. Make sure you are using the current release here before attempting any troubleshooting, otherwise you may end up just chasing ghosts

from react-native-fbsdk-next.

thebergamo avatar thebergamo commented on June 25, 2024

you're faster than me @mikehardy :p

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024

Haha just getting that first cup of coffee and rolling through notifications @thebergamo πŸ˜β˜• cheers

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024

How should i edit this ?

You don't? The fix was merged so it's not necessary. Make sure you are using the current release here before attempting any troubleshooting, otherwise you may end up just chasing ghosts

:) Well, i am receiving exact same error.

Hence my RN version is 0.61.5 , I use 4.2.0 and cant use 4.3.0 as the document says. So I am looking for a fix on 4.2.0

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024

I believe 4.3.0 was specifically released to restore compatibility with older RN versions. The document may be out of date. How did it go when you tried it?

I did not try it hence document clearly says To use this library you need to ensure you match up with the correct version of React Native you are using..

`

FB SDK lib version Required React Native Version

= 9.3.0+ | react-native-fbsdk-nextΒ > 4.3.0 | >=0.63.3

`

So I am not talking gibberish mate

from react-native-fbsdk-next.

mikehardy avatar mikehardy commented on June 25, 2024

@ugrdursun what do you think of #71 ? I tried to expose the actual technical tradeoff if old versions are used - they do work now and we are not trying to break anyway, but it could happen by accident again since old versions are out of support really, meaning no one tests on them actively

from react-native-fbsdk-next.

ugrdursun avatar ugrdursun commented on June 25, 2024

@ugrdursun what do you think of #71 ? I tried to expose the actual technical tradeoff if old versions are used - they do work now and we are not trying to break anyway, but it could happen by accident again since old versions are out of support really, meaning no one tests on them actively

With RN 0.61.5 and library 4.3.0 I did not receive any crash reports on a live app with around 15k+ users

from react-native-fbsdk-next.

kevwang19 avatar kevwang19 commented on June 25, 2024

I also have RN 0.61.5 and would like to use the 4.3.0 library if it fixes issues like mentioned above, but when I tried to install it, npm gave an err saying "unable to resolve dependency tree" since the dependency is >=0.63.3

It says
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

Not sure if it's ok to force something like this... is this how you did it? @ugrdursun
I usually don't run into situations like this so it's the first time for me where there's a dependency conflict that's hard to get around

I guess a better question is - is it safer/better for long term stability to use 4.2.0 and just try to fix the android issue, or use 4.3.0 despite the dependency conflict?

from react-native-fbsdk-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.