Incorrect package in AndroidManifest after upgrade to AGP 8

Describe the issue

I updated my project to agp 8 and target sdk 34.
I use square_in_app_payments plugin version 1.7.8

I’m trying to build apk and run my app in android but fail build and show below error:

Here is the log:

Incorrect package="sqip.flutter" found in source AndroidManifest.xml: C:\Users\Alipour\AppData\Local\Pub\Cache\hosted\pub.dev\square_in_app_payments-1.7.8\android\src\main\AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="sqip.flutter" from the source AndroidManifest.xml: C:\Users\Alipour\AppData\Local\Pub\Cache\hosted\pub.dev\square_in_app_payments-1.7.8\android\src\main\AndroidManifest.xml.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':square_in_app_payments:processDebugManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
 > Incorrect package="sqip.flutter" found in source AndroidManifest.xml: C:\Users\Alipour\AppData\Local\Pub\Cache\hosted\pub.dev\square_in_app_payments-1.7.8\android\src\main\AndroidManifest.xml.
   Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
   Recommendation: remove package="sqip.flutter" from the source AndroidManifest.xml: C:\Users\Alipour\AppData\Local\Pub\Cache\hosted\pub.dev\square_in_app_payments-1.7.8\android\src\main\AndroidManifest.xml.

Environment (please complete the following information):

  • platform: [Android]
  • OS and version: [Android]
  • dev environment: [Windows]
  • In-App Payments Plugin version: [1.7.8]
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [Version 10.0.22631.3447], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.0.0)
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources

please help me.
Thanks.

The error message indicates that the package attribute should not be set in the AndroidManifest.xml of a library module, which is what the square_in_app_payments plugin is. This should resolve the build failure you’re experiencing. If the issue persists or if you’re not comfortable making these changes yourself, you might want to check if there’s an updated version of the square_in_app_payments plugin that’s compatible with AGP 8 and Target SDK 34, or consider reaching out to the plugin maintainers for support1.