Java 无法获取高质量映像:找不到包含
我正在尝试使用相机拍摄图像并将其发送到服务器 我遵循了官方文件 但在使用FileProvider从文件路径获取Uri时发生异常 我有个例外 错误-Java 无法获取高质量映像:找不到包含,java,android,android-studio,camera,android-camera-intent,Java,Android,Android Studio,Camera,Android Camera Intent,我正在尝试使用相机拍摄图像并将其发送到服务器 我遵循了官方文件 但在使用FileProvider从文件路径获取Uri时发生异常 我有个例外 错误- 未能找到包含/storage/emulated/0/Android/data/com.example.capture/files/Pictures/20200703_162914_27473949966410567504.jpg的配置根目录 filepath.xml <paths xmlns:android="http://schem
未能找到包含/storage/emulated/0/Android/data/com.example.capture/files/Pictures/20200703_162914_27473949966410567504.jpg的配置根目录 filepath.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="my_images" path="."/>
</paths>
显示
<application>
...
...
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath" />
</provider>
</application>
...
...
...
您的文件提供程序
路径应指向文件所在的位置
在filepath.xml中更改此选项:
为此:
您的文件提供程序
路径应指向文件所在的位置
在filepath.xml中更改此选项:
为此:
否。当getExternalFilesDir()询问@blackapps时,你是对的,我已经编辑了我的答案。看看他通过的路径,它指向他的应用程序目录。重复:getExternalFilesDir()询问否。getExternalFilesDir()询问@blackapps你是对的,我已经编辑了我的答案。查看他正在传递的路径,它指向他的应用程序目录
<application>
...
...
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath" />
</provider>
</application>