CleverTap / clevertap-flutter

CleverTap Flutter SDK
Other
30 stars 42 forks source link

Support Gradle 8x #211

Closed NinoBass closed 3 months ago

NinoBass commented 6 months ago

This issue started happening after upgrading Gradle version to 8.0.

Whenever I try to run the app on Android devices or Android emulator (no issues with iOS), I get this error message:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode... 

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':clevertap_plugin'.
> 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.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Exception: Gradle task assembleStagingDebug failed with exit code 1

Exited (1).

Basically, the fix is to just add this to the android/build.gradle file inside the android block.

 if (project.android.hasProperty("namespace")) {
        namespace 'plugin-bundle-id-goes-here'  
    }
CTLalit commented 4 months ago

We are supporting this in release version 2.2.0