当前位置: 首页 > 知识库问答 >
问题:

找不到包含/storage/emulated/0/Android/data的已配置根目录/

强安和
2023-03-14

Java文件

java.lang.IllegalArgumentExcture:未能找到包含 /storage/emulated/0/Android/data/com.chandan.halo/files/Pictures/JPEG_20170216_233855_-96483920.jpg的配置根

第Uri photouURI=…行中出现错误。。。。。。

if (photoFile != null) {
                Uri photoURI = FileProvider.getUriForFile(this,
                        "com.chandan.halo.fileprovider",
                        photoFile);
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
                startActivityForResult(takePictureIntent, 300);
            }

文件\u paths.xml

    <?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="my_images" path="Android/data/com.chandan.halo/Pictures" />
    <!--<external-cache-path name="name" path="path" />-->
</paths>

manifest.xml:

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

共有1个答案

晋言
2023-03-14

替换:

<external-path name="my_images" path="Android/data/com.chandan.halo/Pictures" />

与:

<external-files-path name="my_images" path="Pictures" />
 类似资料: