Firelands128 / photo_gallery

A Flutter plugin that retrieves images and videos from mobile native gallery.
BSD 3-Clause "New" or "Revised" License
68 stars 59 forks source link

Missing `namespace` breaking Android build for Gradle version 8 #76

Open nicklbaert opened 4 months ago

nicklbaert commented 4 months ago

When using gradle version 8, all plugins need to define a namespace inside android/build.gradle.

A problem occurred configuring project ':photo_gallery'.
> 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: /Users/nicklbaert/.pub-cache/hosted/pub.dev/photo_gallery-2.2.1/android/build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

There needs to be a new value in the android {...} block:

android {
    compileSdkVersion 34
    ...
    namespace 'com.example.app'
}

See https://github.com/llfbandit/record/commit/2e03b4ab634e03e6e695fe62f67a15f230e2d7de for reference on how the record package implemented this.