Search code examples
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.

  • What went wrong: A problem occurred configuring project ':image_gallery_saver'.

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

    image_gallery_saver_plus: ^3.0.5 ✅

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

    ImageGallerySaver.saveImage(png);    // OLD
    

    TO

    ImageGallerySaverPlus.saveImage(png);    // NEW
    

    AND, FROM

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

    TO

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

    WHY: image_gallery_saver is almost 16 months old. It's now obsolete. Use updated lib image_gallery_saver_plus. This is forked from image_gallery_saver and it's up to dated.

    See the offical documentation at pub.dev/packages/image_gallery_saver_plus