facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.52k stars 24.27k forks source link

could not link react-native-fbsdk #14670

Closed vu-dang closed 7 years ago

vu-dang commented 7 years ago

I'm not sure if this is a bug with rnpm. I was trying to run

react-native link react-native-fbsdk

and got this error:

rnpm-install info Android module react-native-fbsdk is already linked rnpm-install info Linking react-native-fbsdk ios dependency rnpm-install ERR! Something went wrong while linking. Error: Expected "/*", "//", or "{" but "<" found. Please file an issue here: https://github.com/facebook/react-native/issues

Expected "/*", "//", or "{" but "<" found.

RyanWan commented 7 years ago

+1

didrikhegna commented 7 years ago

+1

thienpow commented 7 years ago

delete package-lock.json and redo npm install, the npm 5 is broken, you either always have to delete package-lock.json and redo npm install or just use npm 4

manggit commented 7 years ago

I followed the steps and am still getting the error

manggit commented 7 years ago

I ran npm install --save react-native-fbsdk@0.6.0 react-native link react-native-fbsdk Everything worked fine

Finally I updated my react-natvie-fbsdk by running npm update react-native-fbsdk

Charles-LMQ commented 7 years ago

npm install --save react-native-fbsdk@0.6.0 react-native link react-native-fbsdk it is ok

but if you forget update to latest, android will get a trouble in build.gradle you need to change

compile('com.facebook.android:facebook-android-sdk:4.+') to compile('com.facebook.android:facebook-android-sdk:4.22.1')

alxvallejo commented 7 years ago

@manggit I can run that command ok, but for every subsequent react-native link i run, i hit the same error at Linking react-native-fbsdk ios dependency

hindsricardo commented 7 years ago

@Charles-LMQ your suggestion worked. It didn't work at first so I had to upgrade from npm 3.3.9 to 5.0.4 then went down to 0.6.0 for fbsdk.

dependencies": { "native-base": "^2.2.0", "react": "16.0.0-alpha.12", "react-native": "^0.45.1", "react-native-deprecated-custom-components": "^0.1.0", "react-native-fbsdk": "^0.6.0" },

@thienpow - this has nothing to do with package-lock.json from what i can tell. Removed it multiple times and nada.

antonellil commented 7 years ago

Also hitting this. Installing 0.6.0 works however.

raduflp commented 7 years ago

looks like the issue is stuck at this PR https://github.com/facebook/react-native-fbsdk/pull/349

fabualrub commented 7 years ago

npm install --save react-native-fbsdk@0.6.0 then open [yourproject]\node_modules\react-native-fbsdk\android\src\main\java\com\facebook\reactnative\androidsdk\FBSDKPackage.java

comment / @Override public List<Class<? extends JavaScriptModule>> createJSModules() { return Collections.emptyList(); }/

then react-native link

every thing will be fine

phil-andrews commented 7 years ago

+1

React-Native: 0.47.2 React-Native-FBSDK: 0.6.0

This works for iOS but how have you got it to run on Android? I keep running into:

Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

victorbadila commented 7 years ago

+1 the workaround involving installing 0.6.0, linking, update to 0.6.1 works but only temporary. each time I need to relink I have to do it again, I think this issue should still be open.

phil-andrews commented 7 years ago

This should absolutely still be open. 0.6.1 does not work with iOS. This makes it necessary to split the project into iOS/Android with two different package.json. I filed a formal bug at developers.facebook a week ago.

I've tested with a completely clean build at 0.47.2 just for the FBSDK to no avail. You'd have to down-version RN to get 0.6.1 to work but I'm not sure how far down. I've seen reports of 0.45 being ok.

quangduz commented 7 years ago

Its works with RN 0.48.1 and FB SDK 0.6.0

Durzas-MacBook-Pro:test0_48_1 durza$ react-native install react-native-fbsdk@0.6.0 Scanning 584 folders for symlinks in /Users/durza/test0_48_1/node_modules (7ms) yarn add v0.27.5 warning ../package.json: No license field [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 1 new dependency. └─ react-native-fbsdk@0.6.0 Done in 4.40s. Scanning 585 folders for symlinks in /Users/durza/test0_48_1/node_modules (6ms) rnpm-install info Linking react-native-fbsdk android dependency rnpm-install info Android module react-native-fbsdk has been successfully linked rnpm-install info Linking react-native-fbsdk ios dependency rnpm-install info iOS module react-native-fbsdk has been successfully linked rnpm-install info Module react-native-fbsdk@0.6.0 has been successfully installed & linked

screen shot 2017-09-05 at 3 34 04 am
phil-andrews commented 7 years ago

Right, 0.6.0 works with 0.47.2 as well, 0.6.1 does not. And 0.6.0 does not work with Android/RN 0.47.2. Android requires 0.6.1

gaultierq commented 7 years ago

Does anybody have a combinaison of versions working on both android and ios ?

quangduz commented 7 years ago

RN 0.48.1 & FBSDK 0.6.0 ... working both android & ios

phil-andrews commented 7 years ago

Just received an update on my bug report. Haven't gotten a chance to try this yet but if someone wants to give it a shot...

"While we work on a fix, as a workaround, can you try deleting the file project.pbxproj from the React Native SDK and confirm that solves the issue?"

jetpackpony commented 7 years ago

There is a PR fixing this issue still unmerged: facebook/react-native-fbsdk#349 (as mentioned above by @raduflp). There is a workaround here: facebook/react-native/issues/14594#issuecomment-315531102. And another discussion here: facebook/react-native#10032

nicoara commented 6 years ago

For the past hours, I am trying unsuccessfully to connect the Facebook SDK in React Native.

0) react-native init demoapp1 0.5) cd demoapp1 1) npm install --save react-native-fbsdk@0.6.3 2) react-native link react-native-fbsdk Scanning folders for symlinks in C:\Users\nicoara\Desktop\demoapp1\node_modules (41ms) rnpm-install info Linking react-native-fbsdk android dependency rnpm-install info Android module react-native-fbsdk has been successfully linked rnpm-install info Linking react-native-fbsdk ios dependency rnpm-install info iOS module react-native-fbsdk has been successfully linked 3) open the folder Android from the demoapp1 in Android Studio shows: Error:Failed to find Build Tools revision 25.0.3 I click on the solution to install Build Tools 25.0.3 4) now following errors appear: Error:Failed to resolve: com.android.support:support-annotations:27.0.1 Android Studio has no proposed solution. also, it does not recognize if I add the following line in MainApplication.java: 'import com.facebook.FacebookSdk'

I am running Windows, Android Studio 2.3.1. npm --version shows: 4.6.1 my package.json shows: "react": "16.0.0", "react-native": "0.51.0", "react-native-fbsdk": "^0.6.3"

( if instead of step 1 follow the official documentation at https://developers.facebook.com/docs/react-native/getting-started I receive the next errors: C:\Users\nicoara\Desktop\demoapp1>react-native install react-native-fbsdk Scanning folders for symlinks in C:\Users\nicoara\Desktop\demoapp1\node_modules (42ms) rnpm-install info Module react-native-fbsdk has been successfully installed & li nked

C:\Users\nicoara\Desktop\demoapp1>react-native link react-native-fbsdk Scanning folders for symlinks in C:\Users\nicoara\Desktop\demoapp1\node_modules (38ms) { Error: Cannot find module 'C:\Users\nicoara\Desktop\demoapp1\node_modules\reac t-native-fbsdk\package.json' at Function.Module._resolveFilename (module.js:485:15) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at getRNPMConfig (C:/Users/nicoara/Desktop/demoapp1/node_modules/react-nativ e/local-cli/core/index.js:52:3) at Object.getDependencyConfig (C:/Users/nicoara/Desktop/demoapp1/node_module s/react-native/local-cli/core/index.js:90:18) at deps.reduce (C:/Users/nicoara/Desktop/demoapp1/node_modules/react-native/ local-cli/link/getDependencyConfig.js:9:24) at Array.reduce (native) at getDependencyConfig (C:/Users/nicoara/Desktop/demoapp1/node_modules/react -native/local-cli/link/getDependencyConfig.js:6:15) at Object.link (C:/Users/nicoara/Desktop/demoapp1/node_modules/react-native/ local-cli/link/link.js:180:24) code: 'MODULE_NOT_FOUND' }

and then still, it does not recognize if I add the following line in MainApplication.java: 'import com.facebook.FacebookSdk' )

How to proceed?

iltoga commented 6 years ago

wtf it's been a whole day trying installing this framework on osx for ios without success... What's wrong with you guys who developed this package? isn't it supposed to ease the use of fbsdk into RN apps?...

my config: xcode 9.0 RN: 0.52.0 react-native-fbsdk: 0.7.0

on android is working. on ios there is NO WAY to make it work. tried everything, from manually importing/linking libraries, to use custom pods.. :(

please some advice, as the docs on FB developer website seems to be broken or at least not working for me.

Luckygirlllll commented 6 years ago

I upgraded react-native-fbsdk to 0.7.0, now IOS stopped working, I see just white screen, when trying to log in/sign up via Facebook. I was trying to downgrade react-native-fbsdk back to 0.6.0, 0.6.2, but this white empty screen is still there. Android works fine. Any advice how is possible to fix that?

RN: 0.47.2

screen shot 2018-03-08 at 11 11 59