React-native-fbsdk: Could not invoke FBGraphRequest.start null

Created on 12 Nov 2018  路  15Comments  路  Source: facebook/react-native-fbsdk

Working fine in iOS but getting error in Android.

react-native-fbsdk is a wrapper around the Facebook SDKs for iOS and Android. GitHub Issues in the facebook/react-native-fbsdk repository are used exclusively for tracking bugs in the React Native wrapper.

screenshot_2018-11-10-17-38-41-276_com tamarkoz

while attempting to run on Android Studio getting error on FileInputStream.java:138

screen shot 2018-11-12 at 12 51 23 pm

Most helpful comment

@ramsagar003 : you must change GraphRequestConfig to null and add your fields parameters like this:

const infoRequest = new GraphRequest('/me?fields=id,name,email', null , responseFacebookInfoCallback);

All 15 comments

Hello @ramsagar003, have you found solution for your issue. I meet the same issue as you when I enable multidex with over 65536 methods on Android. Please give me solution if you solved. Thank you so much.

@vantb9x This is actually bug from android studio configuration, I just close all things and restarted android studio and clean project, Android studio automatically installed needed dependency and changed some version in Gradle.

Then install build from android studio. Its working fine at my end

@ramsagar003, Thank you for your response. I tried but it not work for me. Thank you anyway

@ramsagar003 : you must change GraphRequestConfig to null and add your fields parameters like this:

const infoRequest = new GraphRequest('/me?fields=id,name,email', null , responseFacebookInfoCallback);

The solution above didn't helped me as I need the page access_token. And adding it like this:
const infoRequest = new GraphRequest('/yyyyy/published_posts?fields=id,story,created_time,message,full_picture&access_token=xxxxx', null , responseFacebookInfoCallback);

Is not working.

And when I do it supposedly the right way:
const infoRequest = new GraphRequest( '/yyyyyy/published_posts', { accessToken: 'xxxx', parameters: { fields: { string: 'id,story,created_time,message,full_picture' } } }, this._responseInfoCallback);

I get the: "Could not invoke FBGraphRequest.start null" on Android.
On iOS works though.

Same problem here

I fixed it by restricting a single SDK version, adding to android/build.gradle file the code bellow:

def versionOverrides = [
"com.facebook.android:facebook-android-sdk": "4.37.0",
]

allprojects {
repositories {
...
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]

        if (overrideVersion != null && details.requested.version != overrideVersion) {
            details.useVersion overrideVersion
        }
    }
}

}

Taken from here:
https://developers.facebook.com/support/bugs/260814197942050/?disable_redirect=0

edit: Sorry, can't figure-out how to format the code.

Hi everyone,

On iOS, everything is working fine but on Android, I have exactly the same problem has described above.

I tried all solutions, but none of these worked...

Can anyone has already fixed this problem ?

Thank you

Thank you @Symyon your solution worked for me.

Thank you @Symyon . Your solution worked for me too. Can you please explain what we exactly did in the gradle file and is this a workaround, which might break on higher version of fb android sdk.

Just use implementation 'com.facebook.android:facebook-android-sdk:4.37.0'.

4.38 and above seems to have this issue.

4.37.0

I did this and it worked like a charm! The only problem is that it is asking to open browser the second time I'm logging into the app, but if I press cancel it prompts the inputs to login in again. :/

4.37.0 not working for me :/

@duyv thanks works for me, cheers :)

I have the following code and it is not working? Does anyone know a solution?
`import React, {Component} from 'react';
import {View} from 'react-native';
import {LoginButton, AccessToken, GraphRequest, GraphRequestManager} from 'react-native-fbsdk';

class FBLoginButton extends Component {

_responseInfoCallback(error, result) {
if (error) {
console.log('Error fetching data: ' + error);
} else {
// console.log('Success fetching data: ' + result.email);
console.log('Success fetching data: ' + JSON.stringify(result));
}
}

render() {
return (

// readPermissions={["email", "user_friends", "public_profile"]}
onLoginFinished={
(error, result) => {
if (error) {
console.log("login has error: " + result.error);
} else if (result.isCancelled) {
console.log("login is cancelled.");
} else {
console.log('RES', result)
AccessToken.getCurrentAccessToken().then(
(data) => {
console.log(data.accessToken.toString())
const profileRequestParams = {
fields: {
string: 'name, email'
}
};
const profileRequestConfig = {
httpMethod: 'GET',
version: 'v5.0',
parameters: profileRequestParams,
accessToken: data.accessToken.toString()
}
const infoRequest = new GraphRequest(
'/me?fields=id,name,email',
profileRequestConfig,
this._responseInfoCallback,
);
new GraphRequestManager().addRequest(infoRequest).start();
}
)
}
}
}
onLogoutFinished={() => console.log("logout.")}/>

);
}
};

export default FBLoginButton;`

Was this page helpful?
0 / 5 - 0 ratings