I did all steps from Android Facebook SDK 4 in Eclipse and https://developers.facebook.com/docs/android/getting-started#login_share
My activity:
public class MainActivity extends Activity {
LoginButton loginButton;
CallbackManager callbackManager;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.activity_main);
callbackManager = CallbackManager.Factory.create();
loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions("user_friends");
// Callback registration
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
// App code
}
@Override
public void onCancel() {
// App code
}
@Override
public void onError(FacebookException exception) {
// App code
}
});
final Button but_nova_hra = (Button) findViewById(R.id.nova_hra);
but_nova_hra.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent obrazovkaHry = new Intent(getApplicationContext(), HraActivity.class);
startActivity(obrazovkaHry);
}
});
final Button but_koniec = (Button) findViewById(R.id.konec);
but_koniec.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
}
}
App crashes during start with
Could not find com.facebook.FacebookActivity referenced from method com.facebook.internal.Validate.hasFacebookActivity
Where can the problem be?
EDIT: Just created new blank app with completly same settings and FacebookSdk.sdkInitializing passed sucessfully. There have to be some problem with this specific application, but where ? Both of them have same settings ?
See Question&Answers more detail:os