JayTWWM / Share-Files-And-Screenshot-Widgets-Flutter

This pub lets you share any kind of files (csv, mp4, png etc), take screenshot of the widgets you want and return as Image and share them directly as well in the form of an image.
Other
24 stars 14 forks source link

Namespace not specified. Specify a namespace in the module's build file #28

Open MrCsabaToth opened 1 year ago

MrCsabaToth commented 1 year ago

Steps to Reproduce

I depend on share_files_and_screenshot_widgets 1.0.6 in my app. I just tried to upgrade the Android side of the Flutter app to AGP 8.0+ (to be precise it's AGP 8.1 now), because Android Studio brings up the upgrade assistant for the last half year about this. The upgrade fails because some of the plugins don't have the namespace in their build.gradle. On of the failing plugins is the share_files_and_screenshot_widgets.

The build error message

A problem occurred configuring project ':share_files_and_screenshot_widgets'.
> 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.

Code sample

Current build.gradle:

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 16
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

Expected (the way it is handled in Flutter Community plugins, along with he removal of the namespace from the AndroidManifest.xml):

android {
    // Conditional for compatibility with AGP <4.2.
    if (project.android.hasProperty("namespace")) {
        namespace 'com.twwm.share_files_and_screenshot_widgets'
    }

    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 16
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}

Details


MrCsabaToth commented 1 year ago

Should I create a PR for these three lines?

JayTWWM commented 1 year ago

Yes if you can

MrCsabaToth commented 1 year ago

Ok, this PR has some stuff in it from the past so I'll craft a clean one