Android: FileProvider IllegalArgumentException Failed to find configured root that contains /data/data/**/files/Videos/final.mp4 -
i trying use fileprovider play video private path.facing
java.lang.illegalargumentexception: failed find configured root contains /data/data/xxxxx(package)/files/videos/final.mp4 code:
<paths> <files-path path="my_docs" name="videos/" /> </paths> java code:
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); manifest.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" /> any clues on this?
thanks nitz
you have name , path flipped. name goes in uri, , path relative location within root on filesystem.
go with:
<paths> <files-path name="my_docs" path="videos/" /> </paths>
Comments
Post a Comment