Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider

AndroidFacebookLoginLogcat

Android Problem Overview


Anyone knows what does this error mean? I get it in LogCat shell every time I connect with my android application to Facebook (via emulator).

The code which in charge of authorize functionality:

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.authorize);
	mPrefs = getPreferences(MODE_PRIVATE);
	loginPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    String access_token = mPrefs.getString("access_token", null);
    long expires = mPrefs.getLong("access_expires", 0);
    if(access_token != null) {
    	Singelton.mFacebook.setAccessToken(access_token);
    }
    if(expires != 0) {
    	Singelton.mFacebook.setAccessExpires(expires);
    }
	
	Singelton.mFacebook.authorize(this, new String[] {"email","user_birthday"}, new DialogListener() {
        @Override
        public void onComplete(Bundle values) {
            SharedPreferences.Editor editor = mPrefs.edit();
            editor.putString("access_token", Singelton.mFacebook.getAccessToken());
            editor.putLong("access_expires", Singelton.mFacebook.getAccessExpires());
            editor.commit();
            SharedPreferences.Editor logEditor = loginPref.edit();
            logEditor.putBoolean("login", true);
            logEditor.commit();
            addUser();
        }

        @Override
        public void onFacebookError(FacebookError error) {
        	errorHandler();
        }

        @Override
        public void onError(DialogError e) {
        	errorHandler();
        }

        @Override
        public void onCancel() {
        	Log.d("MyApp", "Facebook cancel");
        }
    });
		
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Singelton.mFacebook.authorizeCallback(requestCode, resultCode, data);
}

Android Solutions


Solution 1 - Android

This can happen due to the following reasons:

  1. You are not connected to internet
  2. You have not given permission for internet access ( Manifest.xml)
  3. You have not used a correct hashkey for the app
  4. You did not provide a correct App Id

Solution 2 - Android

It just means that you don't have the Facebook app installed on your phone. Don't worry too much about it.

The way the Facebook SDK for Android works is that whenever you need to make a request to Facebook, the SDK checks to see if the Facebook app is already installed on your device. If it is installed, the request is made through the app. If the app is not installed, it fetches the data by itself.

Solution 3 - Android

If anyone's problem wasn't remedied by the four solutions, this may help. I was getting this same error when I began to use Fragments to implement the Facebook login. I was using the standard Fragment and not the support library v4 Fragments and after switching to the support library Fragment my problem went away. This may be unique to my situation but thought I'd share it just in case. Also don't forget to set the Fragment if you're using the login button method.

myFacebookLoginButton.setFragment(this); //Assuming you're in a Fragment class

Solution 4 - Android

Simply add the following permission to the AndroidManifest.xml

<uses-permission android:name="android.permission.SET_DEBUG_APP"/>

Solution 5 - Android

As @Vinay-S-Shenoy said, that happens when the Facebook app its not installed on the phone or the simulator. What I do, to avoid this error is to check if the Facebook app its installed before call the facebook.authorize method, an in case the facebook app its not installed I alert this message to the user.

public boolean isFacebookAvailable() {
	
	Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Test; please ignore");
intent.setType("text/plain");
	
	final PackageManager pm = this.getApplicationContext().getPackageManager();
	for(ResolveInfo resolveInfo: pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)){
    	ActivityInfo activity = resolveInfo.activityInfo;
    	// Log.i("actividad ->", activity.name);
		if (activity.name.contains("com.facebook.katana")) {
			return true;
		}
    }
	return false;
}

Solution 6 - Android

Don't forget to override onActivityResult and check if it called(for example if you using fragments)

PS(maybe it will be usefull for others, i faced this trouble when was using parse facebook login =)

Solution 7 - Android

For me (but I work with ionic) it was because of an image missed / template error, before launch :

ionic cordova build android

Maybe it can help others...

Solution 8 - Android

btnFb_photo_post.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // postPhotoToWall(facebook.getAccessToken());
        facebook.authorize(MyFBTestActivity.this,
            new String[] { "publish_stream" },
            new DialogListener() {
                @Override
                public void onFacebookError(FacebookError e) {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(),
                    e.getMessage(), Toast.LENGTH_LONG).show();
                }

                @Override
                public void onError(DialogError dialogError) {
                    // TODO Auto-generated method stub
                    Toast.makeText(getApplicationContext(),
                    dialogError.getMessage(),
                    Toast.LENGTH_LONG).show();
                }

                @Override
                public void onComplete(Bundle values) {
                    postToWall(values.getString(Facebook.TOKEN));
                }

                private void postToWall(String accessToken) {
                    // Toast.makeText(getApplicationContext(),
                    // "trying", Toast.LENGTH_LONG).show();
                    byte[] data = null;
                    Bitmap bi = BitmapFactory.decodeResource(
                        getResources(), 
                        R.drawable.ic_launcher
                    );
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
                    data = baos.toByteArray();
                    Bundle params = new Bundle();
                    // if (facebook.getAccessToken() != null)
                    params.putString(Facebook.TOKEN,
                        facebook.getAccessToken()
                    );

                    params.putString("method", "photos.upload");
                    params.putString("caption", "www.samplelink.com");
                    // params.putString("message",
                    // "www.google.com");

                    params.putByteArray("picture", data);
                    AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
                    mAsyncRunner.request(null, params, "POST",
                        new SampleUploadListener(), null);
                    }

                    @Override
                    public void onCancel() {
                        // TODO Auto-generated method stub
                    }
                }
            );
        }
    });

i am using this code to upload image to FB wall. try once

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRom FreimanView Question on Stackoverflow
Solution 1 - AndroidAnhSirk DasarpView Answer on Stackoverflow
Solution 2 - AndroidVinay S ShenoyView Answer on Stackoverflow
Solution 3 - AndroidJraco11View Answer on Stackoverflow
Solution 4 - AndroidM.ESView Answer on Stackoverflow
Solution 5 - AndroidvrunoaView Answer on Stackoverflow
Solution 6 - AndroidPenzzzView Answer on Stackoverflow
Solution 7 - AndroidAdrien VView Answer on Stackoverflow
Solution 8 - AndroidHemanthView Answer on Stackoverflow