WebEngage / webengage-flutter

WebEngage Flutter Plugin
Apache License 2.0
4 stars 22 forks source link

Namespace not specified in build.gradle causing build failure after AGP upgrade to 8.1.0 #49

Open AzharKV opened 4 weeks ago

AzharKV commented 4 weeks ago

After upgrading the Android Gradle Plugin (AGP) to version 8.1.0 and Gradle to version 8.0.2, the build fails with an error indicating that a namespace is not specified in the module’s build.gradle file. This issue seems to be a result of recent changes in AGP requiring explicit namespace definitions.

Steps to Reproduce:

Upgrade AGP to version 8.1.0 and Gradle to version 8.0.2 in the build.gradle files. Attempt to build the project. Observe the build error related to the namespace.

The issue appeared after updating from AGP version 7.4.2 to 8.1.0 and Gradle from 7.6.3 to 8.0.2. It would be beneficial if the webengage_flutter package could include the required namespace in its build.gradle file to ensure compatibility with these newer versions of the Android Gradle Plugin.

Fluter version: 3.22.3

Screenshot 2024-09-16 at 11 18 29 AM
srinivasa-b commented 1 week ago

@AzharKV have you found a work around for this?

MilindWebEngage commented 1 week ago

@srinivasa-b For now please add the following lines to the android/build.gradle file before the subprojects section of project.evaluationDependsOn(':app'):

subprojects {
    afterEvaluate { project ->
        if (project.hasProperty('android')) {
            project.android {
                if (namespace == null) {
                    namespace = project.group
                }
            }
        }
    }
}
srinivasa-b commented 1 week ago

@AzharKV Awesome it worked! Thanks!