我正在使用Android SDK中的NotesList示例程序进行试验。我在程序中做了轻微的更改,但是当我安装我的编辑版本时,当我尝试在设备上已经安装原始notes程序时,我在控制台中一直得到消息INSTALL_FAILED_CONFLICTING_PROVIDER。我需要在提供者中更改什么以使其成为唯一的数据库?如果我卸载原来的notes程序,然后安装我编辑过的版本,它就可以正常工作。
在android:authorities中列出的权限必须是唯一的。引用此属性的文档:
为了避免冲突,授权名称应该使用java风格的命名约定(例如com.example.provider.卡通提供者)。通常,它是实现提供者的ContentProvider子类的名称
当你安装了旧版本的应用程序并对(支持)库或清单文件进行了更改时,也会发生这种情况。删除旧的应用程序从您的设备(设置->应用程序-> <您的应用程序> ->卸载)将解决这个问题。
重命名包后可能会出现相同的错误。从AndroidManifest.xml中检查android:权威的string.xml中的值。
<provider
android:authorities="@string/content_authority"
android:name=".data.Provider"
... />
在string.xml中,该值应该与manifest中声明的包名相同。
<string name="content_authority">com.whatever.android.sunshine.app</string>
如果你有不同的风格,你想避免在权威名称上的冲突,你可以添加一个applicationIdSuffix来构建类型,并在你的清单中使用结果的applicationId,如下所示:
<...
android:authorities="${applicationId}.contentprovider"/>
如果您在库项目中使用谷歌Maps +谷歌Play Services(特别是如果您最近从Eclipse迁移到Android Studio),当您尝试运行使用您的库的应用程序时,您可能会遇到此错误,而使用相同库的不同应用程序已经安装在您的设备上。
解决办法: 确保defaultConfig。applicationId是在构建的android部分定义的。Gradle文件为每个项目使用您的库
android {
defaultConfig.applicationId = "com.company.appname"
}
我建议使用特定应用程序的包名。有了这个修复,提供者名称将不再冲突,应用程序将按预期运行。
症状
1)。当用户从Play Store安装应用程序时,他们会看到可怕的“-505”安装错误。
2)。当你试图通过Android Studio [INSTALL_FAILED_CONFLICTING_PROVIDER]安装第二个使用你的库的应用程序时,你会看到这个错误消息:
在你的控制台中,你会看到这样一条消息:
Package couldn't be installed in /data/app/com.company.appname-1
com.android.server.pm.PackageManagerException:
Can't install because provider name
com.google.android.gms.measurement.google_measurement_service
(in package com.company.appname) is already used by
com.company.otherInstalledAppName
修复方法是确保defaultConfig. conf。applicationId是在构建的android部分定义的。Gradle文件为每个项目使用您的库
android {
defaultConfig.applicationId = "com.company.appname"
}
更多的阅读可以在原始错误报告中找到:问题784:多个应用程序使用相同的授权提供者名称
基本上这发生在我身上,当我试图改变应用程序的包名。
在模拟器中,之前安装了相同的应用程序。当我试图在更改包名称后安装应用程序时,它说,权限已经被设备中的旧应用程序使用。
只需卸载应用程序,它就解决了我的问题。
同样,权限名称应该始终是:your.package.name.UNIQUENAME;
例子:
<provider
android:name="com.aviary.android.feather.cds.AviaryCdsProvider"
android:authorities="your.package.name.AviaryCdsProvider"
/>
如果您正在使用Facebook SDK,那么问题可能在于您为Facebook提供商提供的“权限”值。
取代,
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.FacebookContentProvider"
android:exported="true" />
与- - - >
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.FacebookContentProvider[YOUR_APP_ID]"
android:exported="true" />
您可能需要更改defaultConfig。ApplicationId也在其他答案中建议。
我尝试了很多方法,但都没有找到解决方法。但是这个链接帮助了我……我想详细谈谈……
我正在运行Instrumented测试用例,所以我的应用程序在启动器中不可见…但它是安装的,因此使用相同的内容提供程序。所以,我应该卸载它。所以设置->应用程序管理器->所有下载的应用程序->卸载所有应用程序从您当前的开发包
现在,试着跑……这会有用的……
如果你使用Facebook内部应用程序检查供应商标签内AndroidManifest文件,并检查你的项目Id是正确的android:权威
<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider112623702612345" android:exported="true" />
我在几个应用程序中使用一个库时遇到了类似的问题。有必要用下面的提供者声明更新你的AndroidManifest.xml。
<manifest ...>
<application ...>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.here.this.library.provider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities">
</provider>
</application>
</manifest>
在我的android设备上,我安装了不同版本的同一款应用。这给了我错误安装失败冲突提供者。 所以我卸载了同一款应用的所有版本。 和尝试
adb install -r /Users/demo-debug-92acfc5.apk
它解决了我的问题。
遇到这个问题。
解决方法:
1 -打开AndroidManifest.xml
2 - ctrl+f查找“provider”
3 -找到提供者并更新你的根目录名。
运行项目。希望问题会得到解决!
我本以为通过拖拽图标到“卸载”来卸载应用程序就能解决问题,但事实并非如此。
下面是解决问题的方法:
进入设置 选择应用程序 找到你的应用(是的,我很惊讶仍然在这里找到它!)并按下它 在右上角,按下3个点 选择“卸载所有用户”
再试一次,现在应该可以工作了。
如果你在Xamarin上,你得到这个错误(可能是因为Firebase.Crashlytics):
INSTALL_FAILED_CONFLICTING_PROVIDER
Package couldn't be installed in [...]
Can't install because provider name dollar_openBracket_applicationId_closeBracket (in package [...]]) is already used by [...]
正如这里提到的,你需要更新Xamarin.Build.Download:
Update the Xamarin.Build.Download Nuget Package to 0.4.12-preview3 On Mac, you may need to check Show pre-release packages in the Add Packages window Close Visual Studio Delete all cached locations of NuGet Packages: On Windows, open Visual Studio but not the solution: Tools -> Option -> Nuget Package Manager -> General -> Clear All Nuget Cache(s) On Mac, wipe the following folders: ~/.local/share/NuGet ~/.nuget/packages packages folder in solution Delete bin/obj folders in solution Load the Solution Restore Nuget Packages for the Solution (should run automatically) Rebuild
need to use android:name="androidx.core.content.contentprovider
or android:name="androidx.core.content.provider insteadof
android:name="androidx.core.content.fileprovider
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.contentprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
我遇到了这样的问题:
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER
但它不是来自舱单供应商 我的应用程序中的以下库与其他应用程序有冲突,其他应用程序无法安装:
implementation 'com.iceteck.silicompressorr:silicompressor:2.2.1'
解决方案1
在物理设备而不是模拟器上运行应用程序。我遇到了这个问题,我的应用程序没有定义一个内容提供者。
解决方案2
在另一个实例中,我有一个测试应用程序安装匹配相同的applicationId。
为了解决这个问题,我必须运行。/gradlew uA - uA是uninstallAll task的缩写。
你也可以使用Gradle面板,选择导航到app\install\uninstallAll任务
如果使用模拟器,则可以擦除数据
我有这个错误,当实现一个库与以下AndroidmManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="library.path.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
当我在Project AndroidManifest.xml (app/src/main)中放入以下代码时,我解决了这个问题:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
</provider>
它帮助了我:进入AndroidManifest并粘贴或替换此代码
<provider
android:authorities="${applicationId}.here.this.library.provider"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities" >
</provider>
这是显而易见的,但也要确保你没有在android中混淆了对applicationId的引用:权威。
在我的例子中,我犯了一个错误,漏掉了该死的美元符号:
android:authorities="{applicationId}.myprovider"
而不是:
android:authorities="${applicationId}.myprovider"
这不会立即导致任何错误(因为它是有效的权威名称)。但几天后,当我尝试安装一个应用程序的不同变体时,要了解错误是什么真的很痛苦,因为错误消息没有提供关于内容提供者错误的太多信息。
解决此问题的另一种方法是比较合并的清单,寻找相同的权限。
是啊!我和你有同样的问题。就像你说的,你用了“变异”。保持“权威”的唯一性,你可以这样写
android:authorities="${applicationId}.provider"
如果你在一个应用程序中使用了不止一个lib,原因与上面相同。
如果您正在使用提供者检查,并按照以下方法进行检查
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="androidx.multidex.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_path" />
</provider>
或者使用它
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.contentprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_path" />
</provider>
此外,如果应用程序已经退出在您的移动卸载,然后检查
如果你正在使用受众网络内容提供者,你需要在你的应用程序AndroidManifest.xml中添加这段代码
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider165632208074623"
android:exported="true" />
你的Facebook应用id是> 165632208074623
如果你只需要使用facebook来登录你的应用程序,这里有一个提示: (此修复在cordova项目中工作) 必须完成步骤1和步骤2才能修复该问题。
1. 找到这个文件:platform/android/android.json 在该文件中: 删除此代码:
,{"xml": "<provider android:authorities=\"com.facebook.app.FacebookContentProvider<FACEBOOK_APP_ID>\" android:exported=\"true\" android:name=\"com.facebook.FacebookContentProvider\" />","count": 1
}
然后定位文件:platforms/android/app/src/main/androidManifest.xml
删除此代码:
<provider android:authorities="com.facebook.app.FacebookContentProvider<FACEBOOK_APP_ID>" android:exported="true" android:name="com.facebook.FacebookContentProvider" />
现在应用程序可以运行良好.. 如果这个答案与OP无关,我很抱歉,但它可能会帮助许多其他有这个问题的人。我在其他地方找不到确切的答案。
我尝试了很多方法,但都没有找到一个解决方案: 我在AndroidManifest中修改了这个
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.com.shareFile"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
就像@Jose L Ugia所说的那样,让当局做出改变。
(您可以在清单中找到提供者(合并清单))
大多数情况下,它会连接到你实现的SDK,所以删除SDK实现行并同步Gradle,然后再次添加实现行并同步Gradle。
实施路线: 实现文件(<您的SDK>)
提供者代码:(你必须在merge-manifest中向下滚动才能找到它)
推荐文章
- 安装在控制台显示错误:安装失败,冲突的提供程序
- 如何在Android中制作倒计时计时器?
- Android中的。dex文件是什么?
- 如何将一些数据传输到另一个片段?
- 在Android操作系统上运行Haskell程序
- Android上的FFmpeg
- 横向列表视图在Android?
- 标准的Android菜单图标,例如刷新
- 改变开关的“开”色
- 以编程方式将EditText的输入类型从PASSWORD更改为NORMAL,反之亦然
- 如何在隐藏和查看密码之间切换
- 在Android上调整一个大的位图文件到缩放输出文件
- 如何更改Android版本和代码版本号?
- Android Studio突然无法解析符号
- 应用程序重新启动而不是恢复