AgoraIO-Extensions / AgoraIO-Extensions/Agora-Flutter-SDK

[Android] Duplicate namespace 'io.agora.rtc' causes build failure with AGP 9.x

未關閉
#2,676 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Dart
星號
795
分支
448
平均合併
12 小時 19 分鐘
30 天內合併 PR
14

描述

### Version of the agora_rtc_engine

6.5.3 / 6.6.3 (both affected)

### Platforms affected

- [x] Android
- [ ] iOS
- [ ] macOS
- [ ] Windows
- [ ] Web

### Steps to reproduce

1. Create a new Flutter project
2. Add `agora_rtc_engine: 6.5.3` (or 6.6.3) to `pubspec.yaml`
3. Run `flutter pub get`
4. Set AGP to 9.x in `android/build.gradle.kts`
5. Set Gradle wrapper to 9.7.0 in `gradle-wrapper.properties`
6. Run `flutter build apk` or `flutter run`

### Expected results

Project builds successfully with AGP 9.x and Gradle 9.7.0.

### Actual results

Build fails with the following manifest merger error:

Namespace 'io.agora.rtc' is used in multiple modules and/or libraries:
io.agora.rtc:iris-rtc:4.5.2-build.1, io.agora.rtc:full-sdk:4.5.2,
io.agora.rtc:full-rtc-basic:4.5.2, io.agora.rtc:ains:4.5.2,
io.agora.rtc:ains-ll:4.5.2, io.agora.rtc:audio-beauty:4.5.2,
io.agora.rtc:clear-vision:4.5.2, io.agora.rtc:full-content-inspect:4.5.2,
io.agora.rtc:screen-capture:4.5.2, io.agora.rtc:full-virtual-background:4.5.2,
io.agora.rtc:spatial-audio:4.5.2, io.agora.rtc:aiaec:4.5.2,
io.agora.rtc:aiaec-ll:4.5.2, io.agora.rtc:full-vqa:4.5.2,
io.agora.rtc:full-face-detect:4.5.2, io.agora.rtc:full-face-capture:4.5.2,
io.agora.rtc:full-voice-drive:4.5.2, io.agora.rtc:full-video-codec-enc:4.5.2,
io.agora.rtc:full-video-codec-dec:4.5.2,
io.agora.rtc:full-video-av1-codec-enc:4.5.2,
io.agora.rtc:full-video-av1-codec-dec:4.5.2, io.agora.infra:aosl:1.2.13.1

AGP 9 introduced strict unique namespace validation. All Agora sub-libraries
declare `package="io.agora.rtc"` in their AndroidManifest.xml, which AGP 8
tolerated as a warning but AGP 9 rejects as a fatal error.

The only current workaround is downgrading to AGP 8.x, which is not viable
as Flutter is deprecating AGP 8 support.

### Code sample

Code sample

```yaml
# pubspec.yaml
dependencies:
agora_rtc_engine: 6.5.3

// android/build.gradle.kts
plugins {
id("com.android.application") version "9.2.1" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
}

# gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.0-all.zip

### Screenshots or Video

Image

### Logs

Logs

```console
[io.agora.rtc:iris-rtc:4.5.2-build.1] AndroidManifest.xml Error:
Namespace 'io.agora.rtc' is used in multiple modules and/or libraries:
io.agora.rtc:iris-rtc:4.5.2-build.1, io.agora.rtc:full-sdk:4.5.2,
io.agora.rtc:full-rtc-basic:4.5.2, io.agora.rtc:ains:4.5.2,
io.agora.rtc:ains-ll:4.5.2, io.agora.rtc:audio-beauty:4.5.2,
io.agora.rtc:clear-vision:4.5.2, io.agora.rtc:full-content-inspect:4.5.2,
io.agora.rtc:screen-capture:4.5.2, io.agora.rtc:full-virtual-background:4.5.2,
io.agora.rtc:spatial-audio:4.5.2, io.agora.rtc:aiaec:4.5.2,
io.agora.rtc:aiaec-ll:4.5.2, io.agora.rtc:full-vqa:4.5.2,
io.agora.rtc:full-face-detect:4.5.2, io.agora.rtc:full-face-capture:4.5.2,
io.agora.rtc:full-voice-drive:4.5.2, io.agora.rtc:full-video-codec-enc:4.5.2,
io.agora.rtc:full-video-codec-dec:4.5.2,
io.agora.rtc:full-video-av1-codec-enc:4.5.2,
io.agora.rtc:full-video-av1-codec-dec:4.5.2,
io.agora.infra:aosl:1.2.13.1

Execution failed for task ':app:processDebugMainManifest'
> Manifest merger failed with multiple errors, see logs
```

### Flutter Doctor output

[!] Flutter (Channel stable, 3.47.0, on macOS 15.7.9 24G830 darwin-x64, locale es-VE) [840ms]
! Flutter is deprecating support for Intel-based Macs. A future version of Flutter will require an Apple Silicon Mac to build applications.
• Flutter version 3.47.0 on channel stable at /Users/carlos/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cf2416426 (6 days ago), 2026-08-11 11:53:49 -0700
• Engine revision 5f77625673
• Dart version 3.13.0
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, no-enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [4,3s]
• Android SDK at /Users/carlos/Library/Android/sdk
• Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
• Platform android-37.0, build-tools 36.1.0
! Multiple adb binaries found. This can cause conflicts and device detection issues:
- /Users/carlos/Library/Android/sdk/platform-tools/adb
- /usr/local/Caskroom/android-platform-tools/36.0.0/platform-tools/adb
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 25.0.2+-15348964-b329.117)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.3) [4,3s]
• Xcode at /Users/carlos/Downloads/Xcode.app/Contents/Developer
• Build 17C529
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [16ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (4 available) [7,6s]
• SM A336M (mobile) • RFCW10YM1TM • android-arm64 • Android 13 (API 33)
• iPhone de carlos (mobile) • 00008101-000418DC1E2BA01E • ios • iOS 26.6 23G71
• macOS (desktop) • macos • darwin-x64 • macOS 15.7.9 24G830 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 151.0.7922.138

[✓] Network resources [509ms]
• All expected network resources are available.

! Doctor found issues in 1 category.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。