I am trying to take a look on the Facebook SDK for android, and I have created a new empty project, which the AndroidManifest.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.test.facebook_test"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".TestApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
And my MainActivity looks like this:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(MainActivity.this,com.facebook.FacebookActivity.class);
startActivity(intent);
}
}
However, the Facebook activity can never be launched, with the error:
E/LoginFragment: Cannot call LoginFragment with a null calling package. This can occur if the launchMode of the caller is singleInstance.
By looking through other threads on stackoverflow, I learnt that having android:launchMode="singleTask" would cause this problem, but my problem here is that I didn't set any of the activity to be android:launchMode="singleTask" in the manifest at all.
So what would be the problem here? And how to fix it?