当我构建多个productFlavor时,使用Facebook SDK使用INSTALL_FAILED_CONFLICTING_PROVIDER [英] INSTALL_FAILED_CONFLICTING_PROVIDER with Facebook SDK when I build multiple productFlavors
问题描述
我正在构建一个具有多个productFlavors
的Android应用,并使用Facebook SDK v4.1进行登录和共享内容.问题是,当我尝试在已经安装了相同应用程序(但口味不同)的设备上安装应用程序时,会引发错误.除非我卸载现有应用程序,否则它不允许我安装第二个应用程序.
I'm building an Android app with multiple productFlavors
, and using Facebook SDK v4.1 for login and sharing contents. The problem is that when I try to install an app on a device which already has the same app installed (but different flavor), it raises an error. It doesn't allow me to install the second app unless I uninstall the existing one.
<provider android:authorities="com.facebook.app.FacebookContentProvider{my_app_id}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>
根据此文档,
According to this document, the android:authorities
should be unique and I should have multiple auths to accomplish what I want to do. However, I can't have multiple Facebook AppIds, and was wondering if there's better way to solve this problem. Thanks in advance to anyone who can help me!
推荐答案
尝试以下方法:
清单
Try below :
Manifest
<provider android:authorities="com.facebook.app.FacebookContentProvider${facebookId}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="fb${facebookId}"/>
Gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.your.package"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
manifestPlaceholders = [facebookId:"123456789"]
}
productFlavors {
debug {
applicationIdSuffix ".debug"
manifestPlaceholders = [facebookId:"1234"]
}
release {
applicationIdSuffix ".pro"
manifestPlaceholders = [facebookId:"123456789"]
}
}
这篇关于当我构建多个productFlavor时,使用Facebook SDK使用INSTALL_FAILED_CONFLICTING_PROVIDER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!