Android-Image-Cropper icon indicating copy to clipboard operation
Android-Image-Cropper copied to clipboard

camera click image not coming in result on android 11

Open geeta4 opened this issue 4 years ago • 6 comments

error in result while picking camera image on android 11

Failed to load sampled bitmap: file:///storage/emulated/0/Android/data/com.hhstudio/cache/pickImageResult.jpeg File is not a picture

geeta4 avatar Mar 12 '21 10:03 geeta4

@geeta4 please check:

https://github.com/ArthurHub/Android-Image-Cropper/issues/818

Canato avatar Mar 15 '21 01:03 Canato

Replace the method getCaptureImageOutputUri in the CropImage.java file with the below code, might solve the problem. it worked for me

public static Uri getCaptureImageOutputUri(@nonnull Context context) { Uri outputFileUri = null; File getImage = context.getExternalCacheDir(); if (getImage != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { outputFileUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", new File(getImage.getPath(), "pickImageResult.jpeg")); } else { outputFileUri = Uri.fromFile(new File(getImage.getPath(), "pickImageResult.jpeg")); } } return outputFileUri; }

sachin-varshney avatar Apr 28 '21 06:04 sachin-varshney

How to get the actual file path from the FileProvider.getUriForFile() How do I get path like file:///storage/emulated/0/Android/data/com.hhstudio/cache/pickImageResult.jpeg

Please help me if there is any solution.

Softkeydel avatar May 03 '21 19:05 Softkeydel

How to get the actual file path from the FileProvider.getUriForFile() How do I get path like file:///storage/emulated/0/Android/data/com.hhstudio/cache/pickImageResult.jpeg

Please help me if there is any solution.

@Softkeydel please read #818

The new version has a method for it

Canato avatar May 04 '21 07:05 Canato

Replace the method getCaptureImageOutputUri in the CropImage.java file with the below code, might solve the problem. it worked for me

public static Uri getCaptureImageOutputUri(@nonnull Context context) { Uri outputFileUri = null; File getImage = context.getExternalCacheDir(); if (getImage != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { outputFileUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", new File(getImage.getPath(), "pickImageResult.jpeg")); } else { outputFileUri = Uri.fromFile(new File(getImage.getPath(), "pickImageResult.jpeg")); } } return outputFileUri; }

thank you very much. This works for me also

ahmednabeel1991 avatar Jul 05 '21 06:07 ahmednabeel1991

how to change that file, because its read only file

IMWaqasFarooq avatar Aug 25 '21 14:08 IMWaqasFarooq