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

4

There are 4 best solutions below

0
On

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

0
On

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"/>
0
On

Its might be an IDE error so should try ignore it. Your are probably using Android Studio or IntelliJ IDEA for your Flutter development. This IDEs are built for Native Android Development and since the cant find the activity in the native code they throw this error.

0
On

I added these lines to /android/app/build.gradle file

android{
//...
    lintOptions {
        abortOnError false
    }
}

and it worked for me.

ref: AndroidManifest class referenced applicationName was not found