Skip to content

Black images on Android 13 #873

@TeamRainless

Description

@TeamRainless

Do you want to request a feature or report a bug?

report a bug

What is the current behavior?

Since updating to Android 13, seemingly randomly, images will appear completely black after upload. Sometimes uCrop simply crashes. I suspect this is because of "startactivityForResult" being deprecated and all the insane hurdles everyone has had to go through in order to get uCrop to work without it. I suspect it might've been completely removed from 13.

What is the expected behavior?

Not black image.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Here's my solution to get uCrop running:

ActivityResultLauncher<Intent> ucropActivityIntent = registerForActivityResult(
            new ActivityResultContracts.StartActivityForResult(),
            new ActivityResultCallback<ActivityResult>() {
                public void onActivityResult(ActivityResult result) {
                    if (result.getData() != null && result.getResultCode() == RESULT_OK) {

                        Uri selectedUri = result.getData().getData();
                        String selectedUri2 = result.getData().getData().getPath();
                        getMimeType(getApplicationContext(), selectedUri);
                        
                        startCropActivity(selectedUri);

                    }
                }
            });

Please attach any image files, URL and stack trace that can be used to reproduce the bug.

Which versions of uCrop, and which Android API versions are affected by this issue? Did this work in previous versions of uCrop?

Latest uCrop and the Latest API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions