Flutter Image Cropper Android Manifest Error - "com.yalantis.ucrop.UCropActivity, was not found in the project or the libraries"

Viewed 2248

I am getting the error "Class referenced in the manifest, com.yalantis.ucrop.UCropActivity, was not found in the project or the libraries " when I add an activity to my Android Manifest file. Here is the code which is causing the error:

        <activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

I am trying to install the image_cropper package, and in the installation guide it requires that I add this activity statement to the Android Manifest file. I am using MacOS

What I have tried:

  1. I have followed the note in the installation guide "From v1.2.0, you need to migrate your android project to v2 embedding (detail)"

  2. I ran pub get when I added to my pubspec.yaml

  3. I ran flutter doctor and I have no warnings

  4. Cleaned my flutter project and restarted Android Studio

2 Answers

you have to add the two activities in the android manifest that will help you edit the loaded image, the path is android android/app/src/main and add.

<activity android:name="com.android.camera.CropImage"/>
<activity android:name="com.yalantis.ucrop.UCropActivity"/>

I had the same problem and realized I made the silliest mistake. I merged an old project into a new one, and my manifest file was in the wrong place. Make sure it's in android/app/src/main

Related