jitsi / jitsi-meet-flutter-sdk

Jitsi Meet plugin for Flutter
Apache License 2.0
44 stars 33 forks source link

Namespace for Gradle / Android #53

Closed martin-bertele closed 6 months ago

martin-bertele commented 7 months ago

Trying to build with Android Studio:

A problem occurred configuring project ':jitsi_meet_flutter_sdk'.

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.

Other packages had this as well, e.g. in the inappview a version upgrade fixed this

https://github.com/pichillilorenzo/flutter_inappwebview/issues/1975

martin-bertele commented 7 months ago

Here is a workaround

So I guess package-internally the namespace could be set and devs will not run into the error, at the same time the workaround fixes it already.

add to your top-level build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
    }
    // This code is where all the magic happens and fixes the error.
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }
    // This code is where all the magic happens and fixes the error.
}
saghul commented 7 months ago

Thanks for sharing! Happy to take a PR fixing this for good in the project, if you're up for it.

martin-bertele commented 6 months ago

@saghul seems it's already there, just need to merge it. https://github.com/jitsi/jitsi-meet-flutter-sdk/pull/48