title: Android Image Cropper does not work with images from camera
body: <p>I am using Image Cropper provided by <a href="https://github.com/ArthurHub/Android-Image-Cropper" rel="nofollow noreferrer">ArthurHub</a>, It used to work perfectly fine on all tested devices, I can crop images from both gallery and camera. Recently on Galaxy A51 device after updating; if you try to crop image camera the App crashes, but cropping from gallery works fine!</p>
  <p>Here is my code and build.gradle files</p>
  <p>This is my build.gradle(:app) file:</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 30
      buildToolsVersion &quot;29.0.3&quot;
  
      defaultConfig {
          applicationId &quot;com.bostanji.cropper&quot;
          minSdkVersion 21
          targetSdkVersion 30
          versionCode 1
          versionName &quot;1.0&quot;
  
          testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: &quot;libs&quot;, include: [&quot;*.jar&quot;])
      implementation 'androidx.appcompat:appcompat:1.2.0'
      implementation 'com.google.android.material:material:1.3.0'
      implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
      implementation 'androidx.navigation:navigation-fragment:2.3.4'
      implementation 'androidx.navigation:navigation-ui:2.3.4'
      api 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.2'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  
  }
  </code></pre>
  <p>This is my code:</p>
  <pre><code>package com.bostanji.cropper;
  
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  
  import com.google.android.material.floatingactionbutton.FloatingActionButton;
  import com.google.android.material.snackbar.Snackbar;
  import com.theartofdev.edmodo.cropper.CropImage;
  import com.theartofdev.edmodo.cropper.CropImageView;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  
  import android.view.View;
  
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.ImageView;
  
  public class MainActivity extends AppCompatActivity {
  
      private ImageView imageView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          imageView = findViewById(R.id.imageView);
  
          FloatingActionButton fab = findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  startCropper();
              }
          });
      }
  
      private void startCropper(){
          CropImage.activity()
                  .setGuidelines(CropImageView.Guidelines.ON).setAspectRatio(1,1)
                  .start(this);
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
              CropImage.ActivityResult result = CropImage.getActivityResult(data);
              if (resultCode == RESULT_OK) {
                  Uri resultUri = result.getUri();
                  imageView.setImageURI(resultUri);
              } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                  Exception error = result.getError();
              }
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>