occurrence scenario:
refers to a third-party package, and when its photo function is activated, it directly flashes back
java.lang.IllegalArgumentException: Failed to find configured root that contains
/storage/emulated/0/PictureSelector/CameraImage/PictureSelector_20190704_135543.png
at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:739)
at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.luck.picture.lib.PictureSelectorActivity.parUri(PictureSelectorActivity.java:444)
at com.luck.picture.lib.PictureSelectorActivity.startOpenCamera(PictureSelectorActivity.java:378)
at com.luck.picture.lib.PictureSelectorActivity.startCamera(PictureSelectorActivity.java:353)
at com.luck.picture.lib.PictureSelectorActivity$10.onNext(PictureSelectorActivity.java:753)
at com.luck.picture.lib.PictureSelectorActivity$10.onNext(PictureSelectorActivity.java:744)
search data found that it was related to the android system version of the mobile phone, my mobile phone is android 9.0, and I have some requirements on the management rights of the file
first step, specify a FileProvider. Declare an entry
in the androidmanifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
...>
<provider
android:name=".app.MyFileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"
tools:replace="android:resource" />
</provider>
...
</application>
</manifest>
second step, need in project res-> Add: provider_paths.xml
external-path specifies the directory you want to share. The name can be arbitrary but try to avoid the same as above. Path specifies the desired directory
then add the following at the bottom:
<?xml version="1.0" encoding="utf-8"?>
<paths>
.........
<external-path
name="picture_selector"
path="PictureSelector/" />
</paths>
div>
Read More:
- “Securityerror: error ා 2060: Security sandbox conflict: external interface caller XXX cannot access XXX”
- Duplicate class com.xxx.xxx Find in modules problem solving (Aidl interdependence problem)
- remote: XXX Incorrect username or password (access token) fatal: Authentication failed for XXX
- Prompt “XXX is” when debugging real machine busy:Processing symbol Files “and” Xcode will continue when XXX is finished“
- Failed to load bundle…Unable to resolve module `xxx` from xxx: Module `xx` does not exist
- BUG——Could not resolve placeholder ‘xxx‘ in value ‘${xxx}‘
- When error: XXX does not name a type XXX is prompted in QT
- Solution: regarding c2039, XXX is not a member of XXX
- Duplicate modifier for the method XXX in type XXX
- Solve the ad schematic compilation warning (off grid net label XXX at XXX)
- To solve this problem, we can’t find the solution of / storage / emulated / 0 / file. I can’t. You can try this
- [Solved] KEIL Error: source file ‘.XXX.o‘ – object file renamed from ‘XXX.o‘ to …
- package xxx does not exist cannot find symbol
- node.js Cannot find module “XXX” solution
- Vue project startup error: cannot find module XXX
- Failed to read artifact descriptor for xxx:jar Missing
- Flutter SocketException: OS Error: No route to host, errno = 113, address = XXX
- Failed to resolve:com.github.xxx error
- After Android studio is installed, open a pop-up window to prompt failed to load JVM DLL XXX