【问题标题】:File provider exception while integrating Freshdesk in android在 android 中集成 Freshdesk 时文件提供程序异常
【发布时间】:2019-07-17 05:49:25
【问题描述】:

我正在按照以下链接中提到的步骤将 Freshdesk 集成到 android(Nougat) 中:

https://support.freshchat.com/support/solutions/articles/229319-freshchat-android-sdk-integration-steps

我在最新版本的 Freshdesk 的 gradle 文件中添加了依赖项。 在上面链接中提到的集成的第一步中,它说我们可能会收到以下错误作为 Toast 消息

“Freshchat 的 FileProvider 缺失/错误。在运行 Nougat 或更高版本操作系统的设备中,摄像头捕获将失败(错误代码 354)”

为避免该错误,我在我的 AndroidManifest.xml 文件和“freshchat_file_provider_authority”的字符串资源中添加了以下代码。 AndroidManifest.xml 文件中的字符串资源“freshchat_file_provider_authority”和权限具有相同的包名称。

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.mypackage.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/freshchat_file_provider_paths" />
</provider>

<string name="freshchat_file_provider_authority">com.mypackage.provider</string>

但我仍然收到相同的错误:“Freshchat 缺少/错误的 FileProvider。在运行 Nougat 或更高版本的操作系统的设备中,摄像头捕获将失败(错误代码 354)”

请帮忙。 谢谢。

【问题讨论】:

    标签: android freshdesk


    【解决方案1】:

    您只需在 values/strings.xml 文件中添加以下行:

    <string name="freshchat_file_provider_authority">com.mypackage.provider</string>
    

    就是这样。

    【讨论】:

    • 我喜欢这个提供商com.freshdesk.helpdesk.provider 并做了你提到的同样的事情仍然面临同样的问题
    【解决方案2】:

    AndroidManifest.xml

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="com.mypackage.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/freshchat_file_provider_paths" />
    </provider>
    

    值/字符串.xml

    <string name="freshchat_file_provider_authority">com.mypackage.provider</string>
    

    【讨论】:

      【解决方案3】:

      尝试将 android:name="android.support.v4.content.FileProvider" 更改为 android:name="androidx.core.content.FileProvider"

      【讨论】:

      • 但我仍然收到相同的错误:“Freshchat 缺少/错误的 FileProvider。在运行 Nougat 或更高版本的操作系统的设备中,相机捕获将失败(错误代码 354)”请帮助。谢谢。
      • 这个解决方案对我不起作用。即使我也遇到同样的错误。 :(
      猜你喜欢
      • 2016-12-23
      • 1970-01-01
      • 1970-01-01
      • 2022-12-15
      • 2020-11-29
      • 2012-10-09
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      相关资源
      最近更新 更多