我正在使用 Firebase UI 登录并尝试在我的 Android 应用程序中实现 Facebook 登录。启动 firebase ui Activity 时,我得到:
“java.lang.IllegalStateException:Facebook 提供商未配置。确保添加 facebook_application_id
字符串”
我在我的字符串资源中添加了它,它看起来是这样的: 顺便说一下,在 firebase 文档中,字符串名称与 facebook 文档中的不同,这就是它们在 facebook 文档中的样子,也称为 quickstart:
`<string name="facebook_app_id" translatable="false">SOMECODE</string>
<string name="fb_login_protocol_scheme"
translatable="false">SOMECODE</string>`
这是它在 firebase 文档中的样子:
<string name="facebook_application_id"
translatable="false">YOUR_APP_ID</string>
<string name="facebook_login_protocol_scheme"
translatable="false">fbYOUR_APP_ID</string>
我也遇到了一些合并问题,并通过将 tools:replace="android:value"
添加到元数据来修复它,是的,所有内容都添加到应用程序标签中
<meta-data android:name="com.facebook.sdk.ApplicationId"
tools:replace="android:value"
android:value="@string/facebook_app_id"
/>
<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>
我不知道是什么导致了这些问题,但我认为它与字符串名称有关,如果有人能帮助我,我将不胜感激。谢谢!
最佳答案
如前所述在 list 中添加 Facebook 提供商 here .
将您的应用程序 ID 附加到 authorities 值的末尾。例如,如果您的 Facebook 应用程序 ID 是 1234,则声明如下所示:
<provider android:authorities="com.facebook.app.FacebookContentProvider1234"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
关于android - Facebook 提供商未配置。确保添加 `facebook_application_id` 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51665890/