最近在做版本更新,遇到一个坑,废话不多说,先上代码
这里不是坑点,坑点是在兼容7.0以上设置fileprovider的时候
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Offer access to files under Context.getCacheDir() -->
<cache-path name="test" />
<external-path
name="files"
path="test"/>
</paths>
设置path为test,那么在设置下载路径的时候必须在test目录下,不然就会出现解析程序包出错!!!!
private String destFileDir = Environment.getExternalStorageDirectory().getAbsolutePath() + File
.separator + "test";
注意下载文件路径一定是和fileprovider目录对应!!!