问题
I am a beginner of android programming. I am trying to use facebook SSO, therefore I follow the instruction of facebook developers and write a simple testing code:
public class MainActivity extends Activity {
private Facebook facebook = new Facebook("xxxxxxxxxxxxxxx");
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener(){
//@Override
public void onClick(View v) {
facebook.authorize( MainActivity.this, new DialogListener(){
@Override
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
}
@Override
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
@Override
public void onCancel() {
// TODO Auto-generated method stub
}
});
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
The first time I finish the coding it works. The dialog pop out and I can input my email and password. However, the same cant work after the first time. I checked the LogCat and find out the error:
10-17 17:10:07.227: E/ActivityThread(638): Failed to find provider info for
com.facebook.katana.provider.AttributionIdProvider
I have tried many time and what I see is the dialog pop out but close immediately. I have checked for solution and I am sure that the Key Hash matched. Can anyone tell me why? Thanks a lot.
Sorry for my stupid question. I have found that in the LogCat there is a "D/Facebook-authorize(638): Login Success! access_token=...... expires=.....", So I suggest the codes word? however why I dont need to login again even I close my emulator, reboot my computer? How can I switch to other facebook account if I want? Thx a lot.
回答1:
I think the login is success. But here's are some suggestion. If you want to see the dialog page and want to re-enter the user name and password, try to clear the caches of yours apps first before running it again.
来源:https://stackoverflow.com/questions/12939979/cant-login-facebook-in-android-failed-to-find-provider-info-for-com-facebook-ka