我已遵循aFileChooser库进行简历上传。当我上传简历时,我遇到了下面提到的异常。我在Oreo 8.0+设备中遇到此问题。该库可能与8.0+设备不兼容。还有其他解决方案吗?
请帮帮我。
11-14 13:58:12.684 9676-9676/ E/FileSelectorTestActivity: File select error
java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/44
at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
at com.ipaulpro.afilechooser.utils.FileUtils.getPath(FileUtils.java:311)
at com.mpg.manpowerce.controllers.fragments.MPGCreateProfileUploadContentFragment.onActivityResult(MPGCreateProfileUploadContentFragment.java:296)
at com.mpg.manpowerce.controllers.MPGHomeActivity.onActivityResult(MPGHomeActivity.java:706)
at android.app.Activity.dispatchActivityResult(Activity.java:7454)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
清单文件:
这是我的清单文件。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="yourpackagename">
<uses-sdk android:minSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="yourpackagename.android.locationapi.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS" />
<application
android:name="yourpackagename.MPGUnHandledExceptionHandler"
android:allowBackup="true"
android:icon="@drawable/mpg_app_icon"
android:label="@string/mpg_app_name"
android:largeHeap="true"
android:theme="@style/mpg_theme"
android:value="@string/mpg_app_name" >
<activity
android:name="yourpackagename.MPGSplashActivity"
android:label="@string/mpg_app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="yourpackagename.MPGHomeActivity"
android:label="@string/mpg_app_name"
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" >
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="yourpackagename.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
</application>
</manifest>
provider_paths.xml
<?xml version="1.0" encoding="utf-8"?>
<paths>
<files-path
name="share"
path="external_files"/>
</paths>
答案 0 :(得分:0)
在provider_paths.xml
中尝试添加另一条路径为:
<?xml version="1.0" encoding="utf-8"?>
<paths>
...
<external-path
name="downloads"
path="downloads" />
...
</paths>
然后检查是否再次收到此错误。