47

プライベートパスからビデオを再生するために使用しようとしていますFileProvider.Facing

java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/XXXXX(Package)/files/Videos/final.mp4

コード:

<paths>
    <files-path path="my_docs" name="Videos/" />
</paths>

Java コード:

File imagePath = new File(getFilesDir(), "Videos");
File newFile = new File(imagePath, "final.mp4");
Log.d(TAG, "-------------newFile:"+newFile.exists());//True here
//Exception in below line
Uri contentUri = FileProvider.getUriForFile(this,"com.wow.fileprovider", newFile);

マニフェスト.xml

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.wow.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">

<meta-data
    android:name="android.support.FILE_PROVIDER_PATHS"
    android:resource="@xml/file_paths" />

これに関する手がかりはありますか?

ありがとうニッツ

4

3 に答える 3

63

あなたnameとあなたのpath反転があります。nameはファイル システムのルート内の相対位置ですUripath

と一緒に行きます:

<paths>
    <files-path name="my_docs" path="Videos/" />
</paths>
于 2015-07-10T16:09:20.890 に答える