jdamcd / android-crop

Android library project for cropping images
4.54k stars 1.08k forks source link

Android 6.0: Crop image from gallary: java.lang.SecurityException: Permission Denial #254

Open alexei28 opened 7 years ago

alexei28 commented 7 years ago

Eclipse Neon. Android 6.0:

android:minSdkVersion="15" android:targetSdkVersion="15"

My permissions:

<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.GET_TASKS" />
  1. Choose image from gallary
  2. Crop image
  3. Click Save:

Throw exception:

ava.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaDocumentsProvider uri content://com.android.providers.media.documents/document/image%3A34474 from pid=31783, uid=11010 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission() at android.content.ContentProvider.enforceWritePermissionInner(ContentProvider.java:679) at android.content.ContentProvider$Transport.enforceWritePermission(ContentProvider.java:494) at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:466) at android.content.ContentProvider$Transport.openAssetFile(ContentProvider.java:383) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:262) at android.os.Binder.execTransact(Binder.java:453) FATAL EXCEPTION: Thread-15735 Process: md.qsystems.android.tango, PID: 31783 java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaDocumentsProvider uri content://com.android.providers.media.documents/document/image%3A34474 from pid=31783, uid=11010 requires android.permission.MANAGE_DOCUMENTS, or grantUriPermission() at android.os.Parcel.readException(Parcel.java:1620) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183) at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146) at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:621) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:960) at android.content.ContentResolver.openOutputStream(ContentResolver.java:702) at android.content.ContentResolver.openOutputStream(ContentResolver.java:678) at com.soundcloud.android.crop.CropImageActivity.saveOutput(CropImageActivity.java:384) at com.soundcloud.android.crop.CropImageActivity.access$10(CropImageActivity.java:380) at com.soundcloud.android.crop.CropImageActivity$5.run(CropImageActivity.java:313) at com.soundcloud.android.crop.CropUtil$BackgroundJob.run(CropUtil.java:193) at java.lang.Thread.run(Thread.java:818)

AmitBarjatya commented 7 years ago

You also need to add "android.permission.MANAGE_DOCUMENTS" to your manifest.

xiaolvzi commented 6 years ago

Add it, still not work!

gelbertgel commented 6 years ago

It is not working for me too