Since we deployed a new version of our Android app with updated Facebook SDK, we see many users are crashing on Facebook Login. It doesn't reproduce on our devices.
Crash and stacktrace:
Caused by android.content.ActivityNotFoundException
Unable to find explicit activity class {<our_app_id>/com.facebook.e}; have you declared this activity in your AndroidManifest.xml?
android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1850)
android.support.v4.app.Fragment.startActivityForResult (Fragment.java:916)
com.facebook.login.CustomTabLoginMethodHandler.tryAuthorize (CustomTabLoginMethodHandler.java:102)
com.facebook.login.LoginClient.tryCurrentHandler (LoginClient.java:255)
com.facebook.login.LoginClient.tryNextHandler (LoginClient.java:217)
com.facebook.login.LoginClient.authorize (LoginClient.java:122)
com.facebook.login.LoginClient.startOrContinueAuth (LoginClient.java:103)
com.facebook.login.LoginFragment.onResume (LoginFragment.java:154)
android.support.v4.app.Fragment.performResume (Fragment.java:2308)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)
Any ideas what could be causing the crash and how to fix?
=== EDIT ===
Notice that only some of the users are crashing, and when tested locally it seems that we can login without problems.
We defined the Facebook activities in the manifest like recommended in the official documentation:
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"/>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="@string/fb_login_protocol_scheme"/>
</intent-filter>
</activity>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
From stacktrace and Facebook SDK sources it seems that com.facebook.e
is an obfuscated name for com.facebook.CustomTabMainActivity
. I don't know under which circumstances Facebook SDK calls this Activity
but if it is called then it should be defined in AndroidManifest.xml
.
Since it is not defined in your manifest, it will not be obfuscated.
According to this link the missing part of your manifest is:
<activity
android:name="com.facebook.CustomTabMainActivity"
android:exported="true">
</activity>