問題 :在 Android7.0系統(tǒng)使用Intent跳轉(zhuǎn)到APK安裝時候遇到的錯誤
了解:Android7.0 系統(tǒng)權(quán)限更改
為了提高私有文件的安全性,面向 Android 7.0 或更高版本的應(yīng)用私有目錄被限制訪問 (0700)。此設(shè)置可防止私有文件的元數(shù)據(jù)泄漏,如它們的大小或存在性。此權(quán)限更改有多重副作用:
私有文件的文件權(quán)限不應(yīng)再由所有者放寬,為使用?MODE_WORLD_READABLE
和/或?MODE_WORLD_WRITEABLE而進(jìn)行的此類嘗試將觸發(fā)?SecurityException。
傳遞軟件包網(wǎng)域外的 file:// URI 可能給接收器留下無法訪問的路徑。因此,嘗試傳遞 file://URI 會觸發(fā) FileUriExposedException。分享私有文件內(nèi)容的推薦方法是使用?FileProvider。
DownloadManager不再按文件名分享私人存儲的文件。舊版應(yīng)用在訪問?COLUMN_LOCAL_FILENAME時可能出現(xiàn)無法訪問的路徑。面向 Android 7.0 或更高版本的應(yīng)用在嘗試訪問?COLUMN_LOCAL_FILENAME時會觸發(fā)?SecurityException。通過使用 [DownloadManager.Request.setDestinationInExternalFilesDir()](https://developer.android.google.cn/reference/android/app/DownloadManager.Request.html#setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String)或 [DownloadManager.Request.setDestinationInExternalPublicDir()](https://developer.android.google.cn/reference/android/app/DownloadManager.Request.html#setDestinationInExternalPublicDir(java.lang.String, java.lang.String))將下載位置設(shè)置為公共位置的舊版應(yīng)用仍可以訪問?COLUMN_LOCAL_FILENAME中的路徑,但是我們強(qiáng)烈反對使用這種方法。對于由?DownloadManager公開的文件,首選的訪問方式是使用[ContentResolver.openFileDescriptor()](https://developer.android.google.cn/reference/android/content/ContentResolver.html#openFileDescriptor(android.net.Uri, java.lang.String))。
如果7.0之前intent跳轉(zhuǎn)
Intent i =new Intent(Intent.ACTION_VIEW);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setDataAndType(Uri.parse("file://" + file.toString()), "application/vnd.android.package-archive");
startActivity(i);
android 7.0之后可以參考? https://blog.csdn.net/qq_30548105/article/details/79551068
?最重要的來了,我們運(yùn)行遇到的Manifest merger failed with multiple errors, see logs問題
我們在項目中有很多依賴 出現(xiàn)這個錯 是因?yàn)槲覀兊膌ib庫的provider沖突
解決辦法
之前我們清單文件里FileProvider配置是這么寫的

怎么解決呢?
我們需要自己創(chuàng)建一個類??MyFileProvider 繼承? FileProvider

然后在清單文件里 修改配置

重新編譯一下? 這樣問題就解決了 ,你的問題解決沒?