It works perfectly. I can view pdf BUT now i can't install others flavors in my phone because of this error:
Installation did not succeed. The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER Installation failed due to: 'null' Retry
Code for referecnce :
App level build.gradle file
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:-I follow this link but still facing the same issue can't install another falvour in same device even i remove provider tag from AndroidManifest.xml but getting same error.
Link1
Link2
Link3
Your file provider authority must depend on the package name. Right now, it is not dynamic and is the same for all your flavors. You can't have multiple apps with file providers that have the same authorities value.
Make this value depends on the applicationId like this:
<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>
See the documentation for reference:
In this example, the android:authorities attribute specifies the URI authority that you want to use for content URIs generated by the FileProvider. In the example, the authority is com.example.myapp.fileprovider. For your own app, specify an authority consisting of the app's android:package value with the string "fileprovider" appended to it. To learn more about the authority value, see the topic Content URIs and the documentation for the android:authorities attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With