我正在使用 Firebase UI 登录并尝试在我的 Android 应用程序中实现 Facebook 登录。启动 firebase ui 活动时我得到:
“java.lang.IllegalStateException:Facebook 提供商未配置。确保添加一个facebook_application_id
string"
在我的字符串资源中,我添加了它,它是这样的:
顺便说一句,firebase 文档中的字符串名称与 facebook 文档中的字符串名称不同,这就是它们在 facebook 文档中的外观,也称为快速入门:
`<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>
我不知道是什么导致了这些问题,但我认为这与字符串名称有关,如果有人可以帮助我,我将非常感激。谢谢你!
如前所述,在清单中添加 Facebook 提供商here.
将您的应用程序 ID 附加到权限值的末尾。例如,如果您的 Facebook 应用程序 ID 是 1234,则声明如下所示:
<provider android:authorities="com.facebook.app.FacebookContentProvider1234"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)