androidflutterdart

A problem occurred configuring project ':image_gallery_saver'


when i tried to build flutter project i get this error :

FAILURE: Build failed with an exception.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

 If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

I've searched but don't understand and keep getting errors


Solution

  • I Recommend to just change package, It works 100% ✅

    replace this in pubspec.yaml

    image_gallery_saver: ^2.0.3 ❌

    with

    flutter_image_gallery_saver: ^0.0.2 ✅

    And also, replace all imports used and requires some changes in my case I changed only:

    ImageGallerySaver.saveImage(png);    // OLD
    

    TO

    FlutterImageGallerySaver.saveImage(png);  // NEW
    

    AND, FROM

    import 'package:image_gallery_saver/image_gallery_saver.dart'; // OLD
    

    TO

    import 'package:flutter_image_gallery_saver/flutter_image_gallery_saver.dart'; // NEW
    

    WHY: image_gallery_saver is above 20 months old. It's now obsolete. Use updated lib flutter_image_gallery_saver.

    See the offical documentation at https://pub.dev/packages/flutter_image_gallery_saver