Open zemingzeng opened 6 years ago
Not sure if it's the same problem I'm experiencing, but I also get an app crash with "No content provider" as the error message. Here's a stacktrace:
java.lang.RuntimeException: Failed to load sampled bitmap: content://com.estrongs.files/storage/emulated/0/Download/favicon.ico
No content provider: content://com.estrongs.files/storage/emulated/0/Download/favicon.ico
at com.theartofdev.edmodo.cropper.BitmapUtils.decodeSampledBitmap(BitmapUtils.java:130)
at com.theartofdev.edmodo.cropper.BitmapLoadingWorkerTask.doInBackground(BitmapLoadingWorkerTask.java:73)
at com.theartofdev.edmodo.cropper.BitmapLoadingWorkerTask.doInBackground(BitmapLoadingWorkerTask.java:24)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.FileNotFoundException: No content provider: content://com.estrongs.files/storage/emulated/0/Download/favicon.ico
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1396)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1247)
at android.content.ContentResolver.openInputStream(ContentResolver.java:967)
at com.theartofdev.edmodo.cropper.BitmapUtils.decodeImageForOption(BitmapUtils.java:602)
at com.theartofdev.edmodo.cropper.BitmapUtils.decodeSampledBitmap(BitmapUtils.java:114)
at com.theartofdev.edmodo.cropper.BitmapLoadingWorkerTask.doInBackground(BitmapLoadingWorkerTask.java:73)
at com.theartofdev.edmodo.cropper.BitmapLoadingWorkerTask.doInBackground(BitmapLoadingWorkerTask.java:24)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
same issue here D/Cropped Image: Dropped ImageURI Error: java.lang.RuntimeException: Failed to load sampled bitmap: /storage/emulated/0/DCIM/Facebook/FB_IMG_1529141386464.jpg No content provider: /storage/emulated/0/DCIM/Facebook/FB_IMG_1529141386464.jpg V/FA: Activity resumed, time: 5009497
The uri
parameter requires a file://
infront of the image path.
Use this to convert into a uri
before passing it into the CropImageActivity .
Uri.fromFile(new File(IMAGE_PATH))
An even better solution would be:
public Uri myUri(Uri originalUri){
Uri returnedUri = null;
if (originalUri.getScheme() == null){
returnedUri = Uri.fromFile(new File(camUri.getPath()));
// or you can just do -->
// returnedUri = Uri.parse("file://"+camUri.getPath());
}else{
returnedUri = originalUri;
}
return returnedUri;
}
Then you can call the above like this:
CropImage.activity(myUri(imageUri))
.start(this);
or if you have a path as a String:
CropImage.activity(myUri(Uri.parse(pathAsString)))
.start(this);
I say this is a better way because you do not know if the image comes from a content://
scheme or a file://
scheme.
+1 very similar error - also "No content provider" during opening of the activity from a url