Android 使用FileProvider从内部存储打开文件时,外部应用程序停止

Android 使用FileProvider从内部存储打开文件时,外部应用程序停止,android,android-fileprovider,Android,Android Fileprovider,我在内部存储器的自定义文件夹中有一些文件。我需要使用Adobe等外部应用程序打开文件。我计划使用FileProvider打开。但第三方应用程序在尝试打开文档时停止。我真的不知道我在代码中犯了什么错误 包名称=com.example.doc 活动位于package=com.example.doc.activities中 显示 我们需要在清单中指定任何权限吗 任何帮助都将不胜感激 谢谢 Jomia扩展类型是application/pdf?请参考此答案extensionType=application

我在内部存储器的自定义文件夹中有一些文件。我需要使用Adobe等外部应用程序打开文件。我计划使用FileProvider打开。但第三方应用程序在尝试打开文档时停止。我真的不知道我在代码中犯了什么错误

包名称=com.example.doc

活动位于package=com.example.doc.activities中

显示 我们需要在清单中指定任何权限吗

任何帮助都将不胜感激

谢谢
Jomia

扩展类型是application/pdf?请参考此答案extensionType=application/msword;我认为问题只在于你。因为实际上我需要打开这个文件:/data/data/com.example.doc/files/RBC/sample.docx。但是在exportUri.getPath中,只给出了/files/RBC/sample.docx。如何指定crrect路径?文件连接aakunnundo?ie文件il值KittUndoUndoExternal应用程序文件路径正确ayitano KitunanThennu urappilla。如何检查?
<provider
     android:name="android.support.v4.content.FileProvider"
     android:authorities="com.example.doc.fileprovider"
     android:exported="false"
     android:grantUriPermissions="true" 
     android:readPermission="com.example.doc.fileprovider.READ">
     <meta-data
         android:name="android.support.FILE_PROVIDER_PATHS"
         android:resource="@xml/filepath" />
  </provider>
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <files-path name="files" path="." />
</paths>
//tempfilePath = /data/data/com.example.doc/files/RBC/sample.docx

File file = new File(tempfilePath);         
Uri exportUri = FileProvider.getUriForFile (this, "com.example.doc.fileprovider", file);

Intent docViewIntent = new Intent();
docViewIntent.setAction(Intent.ACTION_VIEW);
docViewIntent.setDataAndType(exportUri , extensionType);
docViewIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
docViewIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(docViewIntent);