我已经设置了与以下构建类型特定内容提供商的 Facebook 共享:
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderXXX${applicationId} ...
每种构建类型的 applicationId 都不同,因此我能够在一台设备上并行运行调试和实时构建。
此设置在 Facebook(图像文件)共享时出现错误:
IllegalStateException: A ContentProvider for this app was not set up in the AndroidManifest.xml, please add com.facebook.app.FacebookContentProviderXXX as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.
如何克服这个问题?如何让 Facebook 考虑我的 applicationId?
最佳答案
用于 Facebook 登录和共享的 list 代码如下所示:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/{facebook_app_id}" />
<!-- To use Facebook Login or Share, also add the FacebookActivity to the manifest:-->
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- If you're sharing links, images or video via the Facebook for Android app, you also need to declare
the FacebookContentProvider in the manifest. -->
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider${facebook_app_id}"
android:exported="true" />
注意:
您的应用目前上线并向公众开放。
按照以下步骤使您的 Facebook 应用上线并公开:
1) 转到 https://developers.facebook.com/
2) 选择您的应用并转到应用审核选项卡。
3) 勾选是您的应用目前已上线并可供公众使用。选项。
关于Android Facebook ContentProvider 和多种构建类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37156383/