Skip to content

Fix building Flutter Android APPs - #3559

Merged
csukuangfj merged 1 commit into
k2-fsa:masterfrom
csukuangfj:fix-flutter
Apr 28, 2026
Merged

csukuangfj merged 1 commit into
k2-fsa:masterfrom
csukuangfj:fix-flutter

Conversation

@csukuangfj

@csukuangfj csukuangfj commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3557

Summary by CodeRabbit

  • Chores
    • Updated Android package namespace identifiers to include architecture-specific suffixes (arm64, armeabi, x86, x86_64) for all Android build variants to prevent namespace conflicts across different architecture builds.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 28, 2026
@coderabbitai

coderabbitai Bot commented Apr 28, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bd23942-52d9-4e15-aa36-a00f31907e4b

📥 Commits

Reviewing files that changed from the base of the PR and between 33d0875 and ef5a01d.

📒 Files selected for processing (9)
  • flutter/notes.md
  • flutter/sherpa_onnx_android_arm64/android/build.gradle
  • flutter/sherpa_onnx_android_arm64/android/src/main/AndroidManifest.xml
  • flutter/sherpa_onnx_android_armeabi/android/build.gradle
  • flutter/sherpa_onnx_android_armeabi/android/src/main/AndroidManifest.xml
  • flutter/sherpa_onnx_android_x86/android/build.gradle
  • flutter/sherpa_onnx_android_x86/android/src/main/AndroidManifest.xml
  • flutter/sherpa_onnx_android_x86_64/android/build.gradle
  • flutter/sherpa_onnx_android_x86_64/android/src/main/AndroidManifest.xml

📝 Walkthrough

Walkthrough

Android build configurations for four architecture variants of sherpa_onnx (arm64, armeabi, x86, x86_64) are updated to use architecture-specific package namespaces, appending suffixes like .arm64, .armeabi, etc., to the base package identifier in both Gradle build files and Android manifest declarations.

Changes

Cohort / File(s) Summary
Documentation
flutter/notes.md
Added note documenting that Android flutter create commands now append architecture-specific suffixes to the --org identifier while preserving template and package names.
ARM64 Architecture
flutter/sherpa_onnx_android_arm64/android/build.gradle, flutter/sherpa_onnx_android_arm64/android/src/main/AndroidManifest.xml
Updated android.namespace in build.gradle and package attribute in manifest from com.k2fsa.sherpa.onnx to com.k2fsa.sherpa.onnx.arm64.
ARMeabi Architecture
flutter/sherpa_onnx_android_armeabi/android/build.gradle, flutter/sherpa_onnx_android_armeabi/android/src/main/AndroidManifest.xml
Updated android.namespace in build.gradle and package attribute in manifest from com.k2fsa.sherpa.onnx to com.k2fsa.sherpa.onnx.armeabi.
x86 Architecture
flutter/sherpa_onnx_android_x86/android/build.gradle, flutter/sherpa_onnx_android_x86/android/src/main/AndroidManifest.xml
Updated android.namespace in build.gradle and package attribute in manifest from com.k2fsa.sherpa.onnx to com.k2fsa.sherpa.onnx.x86.
x86_64 Architecture
flutter/sherpa_onnx_android_x86_64/android/build.gradle, flutter/sherpa_onnx_android_x86_64/android/src/main/AndroidManifest.xml
Updated android.namespace in build.gradle and package attribute in manifest from com.k2fsa.sherpa.onnx to com.k2fsa.sherpa.onnx.x86_64.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

size:M

Poem

🐰 Four flavors, each unique in name,
arm64, armeabi, x86 stake their claim,
No more collisions in the build,
With suffixed namespaces fulfilled,
BuildConfig conflicts now tamed! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix building Flutter Android APPs' is vague and generic, using non-descriptive terms that don't convey the specific change (architecture-specific package namespace differentiation). Revise the title to be more specific, such as 'Add architecture-specific suffixes to Android package namespaces' or 'Fix duplicate BuildConfig by using arch-specific org identifiers'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully addresses issue #3557 by adding architecture-specific suffixes (.arm64, .armeabi, .x86, .x86_64) to package namespaces, which prevents duplicate BuildConfig class definitions across ABI-specific jars.
Out of Scope Changes check ✅ Passed All changes are within scope: modifications to notes.md, build.gradle, and AndroidManifest.xml files consistently apply architecture-specific suffixes across all four architecture variants to resolve the duplicate BuildConfig issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@csukuangfj
csukuangfj merged commit 12a79e5 into k2-fsa:master Apr 28, 2026
1 check was pending
@csukuangfj
csukuangfj deleted the fix-flutter branch April 28, 2026 02:22

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Android namespaces and package names for architecture-specific Flutter plugins (arm64, armeabi, x86, and x86_64) to ensure unique identifiers across different builds. The review feedback identifies an inconsistency in the documentation changes within notes.md, noting that the updated flutter create commands would generate redundant package names and should be reverted to maintain consistency with the manual namespace configurations used in the project.

Comment thread flutter/notes.md
Comment on lines +33 to +36
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.arm64 sherpa_onnx_android_arm64
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.armeabi sherpa_onnx_android_armeabi
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.x86 sherpa_onnx_android_x86
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.x86_64 sherpa_onnx_android_x86_64

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The updated flutter create commands are inconsistent with the actual namespace values set in the build.gradle files. Running these commands would result in redundant package names like com.k2fsa.sherpa.onnx.arm64.sherpa_onnx_android_arm64, whereas the code in this PR uses com.k2fsa.sherpa.onnx.arm64.

Actually, the original commands (using --org com.k2fsa.sherpa.onnx) already produced unique namespaces by default (e.g., com.k2fsa.sherpa.onnx.sherpa_onnx_android_arm64). The collision likely occurred because the namespaces were manually overridden in the code. It is recommended to revert these documentation changes to keep the commands clean, as manual adjustment is required anyway to match the specific namespace structure used in this repository.

Suggested change
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.arm64 sherpa_onnx_android_arm64
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.armeabi sherpa_onnx_android_armeabi
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.x86 sherpa_onnx_android_x86
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx.x86_64 sherpa_onnx_android_x86_64
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx sherpa_onnx_android_arm64
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx sherpa_onnx_android_armeabi
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx sherpa_onnx_android_x86
flutter create --template plugin_ffi --platforms android --org com.k2fsa.sherpa.onnx sherpa_onnx_android_x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] BuildConfig is defined multiple times

1 participant