[英]App install failed (INSTALL_FAILED_CONFLICTING_PROVIDER)
[英]After setup app flavouring i got this ERROR "install_failed_conflicting_provider" while run the app/
它完美地工作。 我可以查看 pdf 但現在由於此錯誤,我無法在手機中安裝其他風格:
Installation did not succeed. The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER Installation failed due to: 'null' Retry
參考代碼:
應用級 build.gradle 文件
defaultConfig {
applicationId "com.abc.xyz"
minSdkVersion 21
targetSdkVersion 29
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}
flavorDimensions "version"
productFlavors {
appdev {
dimension "version"
applicationIdSuffix ".dev"
versionCode buildVersionCodeDev()
versionName version_dev
}
appqa {
dimension "version"
applicationIdSuffix ".qa"
versionCode buildVersionCodeQA()
versionName version_qa
}
apppro {
dimension "version"
applicationIdSuffix ".pro"
versionCode buildVersionCodePro()
versionName version_pro
}
}
AndroidManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.freshdesk.helpdesk.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
Note:-
我按照這個鏈接,但仍然面臨同樣的問題,即使我從 AndroidManifest.xml 中刪除了提供者標簽,但仍然遇到同樣的錯誤,無法在同一設備上安裝另一個 falvour。
您的文件提供者權限必須取決於包名稱。 現在,它不是動態的,對於您的所有口味都是一樣的。 您不能擁有多個具有相同authorities
值的文件提供程序的應用程序。 使這個值取決於applicationId
如下所示:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
請參閱文檔以供參考:
在此示例中, android:authorities 屬性指定要用於 FileProvider 生成的內容 URI 的 URI 權限。 在示例中,權限為 com.example.myapp.fileprovider。 對於您自己的應用程序,指定一個權限,該權限由應用程序的 android:package 值組成,並在其后附加字符串“fileprovider”。 要了解有關權限值的更多信息,請參閱主題內容 URI 和 android:authorities 屬性的文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.