-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix building apk #2499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix building apk #2499
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRemoved per-ABI Gradle flags from many APK build scripts and updated APK artifact paths to Gradle's outputs layout; two speaker-related scripts now run a general build and package debug APKs; TTS script had a minor formatting patch removal. Changes
Sequence Diagram(s)sequenceDiagram
participant Script as build script (per-arch loop)
participant Gradle as ./gradlew
participant FS as filesystem (APK path)
Script->>Gradle: ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch
Gradle-->>FS: produces app-release-unsigned.apk at intermediates/...
Script->>FS: mv intermediates/.../app-release-unsigned.apk apks/...
Note over Script,Gradle: OLD (per-ABI build)
sequenceDiagram
participant Script as build script (per-arch loop)
participant Gradle as ./gradlew
participant FS as filesystem (APK path)
Script->>Gradle: ./gradlew assembleRelease
Gradle-->>FS: produces app-release-unsigned.apk at outputs/apk/release/
Script->>FS: mv outputs/apk/release/app-release-unsigned.apk apks/...
Note over Script,Gradle: NEW (generic release build)
sequenceDiagram
participant Script as speaker build script
participant Gradle as ./gradlew
participant FS as filesystem (APK path)
Script->>Gradle: ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch
Gradle-->>FS: produces release unsigned APK
Note over Script,Gradle: OLD
Script->>Gradle: ./gradlew build
Gradle-->>FS: produces app-debug.apk at outputs/apk/debug/
Script->>FS: mv outputs/apk/debug/app-debug.apk apks/...
Note over Script,Gradle: NEW (build -> debug artifact)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes Android APK build issues by reverting PR #2488 and making necessary adjustments to build scripts. The changes address installation errors caused by signing requirements and standardize the build process across all Android applications.
- Removes architecture-specific build flags (
-Pandroid.injected.build.abi=$arch) from Gradle commands - Updates APK file paths from
build/intermediates/apk/tobuild/outputs/apk/to match new Gradle output structure - Switches Speaker Diarization and Speaker Identification apps to build debug APKs instead of release APKs
- Removes automatic "kitten" mode assignment in TTS and TTS Engine applications
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/apk/build-apk-vad.sh | Removes architecture-specific build flags and updates APK paths for VAD builds |
| scripts/apk/build-apk-vad-asr.sh.in | Updates build command and APK path for VAD+ASR applications |
| scripts/apk/build-apk-vad-asr-simulate-streaming.sh.in | Standardizes build process and removes debug find command for streaming ASR |
| scripts/apk/build-apk-tts.sh.in | Removes kitten mode assignment and updates build process for TTS apps |
| scripts/apk/build-apk-tts-engine.sh.in | Removes kitten mode assignment and updates build process for TTS engine |
| scripts/apk/build-apk-speaker-identification.sh.in | Switches to debug build and updates APK path for speaker identification |
| scripts/apk/build-apk-speaker-diarization.sh.in | Switches to debug build and updates APK path for speaker diarization |
| scripts/apk/build-apk-slid.sh.in | Updates build command and APK path for spoken language identification |
| scripts/apk/build-apk-kws.sh | Standardizes build process for keyword spotting applications |
| scripts/apk/build-apk-audio-tagging.sh.in | Updates build command and APK path for audio tagging |
| scripts/apk/build-apk-audio-tagging-wearos.sh.in | Updates build command and APK path for WearOS audio tagging |
| scripts/apk/build-apk-asr.sh.in | Standardizes build process for ASR applications |
| scripts/apk/build-apk-asr-2pass.sh.in | Updates build command and APK path for 2-pass ASR |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| sed -i.bak s/2048/9012/g ./gradle.properties | ||
| git diff ./gradle.properties | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew build |
Copilot
AI
Aug 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ./gradlew build instead of ./gradlew assembleRelease is inconsistent with other build scripts and may produce different build outputs. Consider using ./gradlew assembleDebug to be explicit about building debug APKs.
| ./gradlew build | |
| ./gradlew assembleDebug |
|
|
||
| pushd ./android/SherpaOnnxSpeakerDiarization | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew build |
Copilot
AI
Aug 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using ./gradlew build instead of ./gradlew assembleRelease is inconsistent with other build scripts and may produce different build outputs. Consider using ./gradlew assembleDebug to be explicit about building debug APKs.
| ./gradlew build | |
| ./gradlew assembleDebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🧹 Nitpick comments (9)
scripts/apk/build-apk-vad-asr-simulate-streaming.sh.in (1)
109-109: Harden APK path resolution for future AGP changesInstead of hard-coding
mv android/SherpaOnnxSimulateStreamingAsr/app/build/outputs/apk/release/app-release-unsigned.apk …discover the unsigned APK at runtime:
# right after: ./gradlew assembleRelease APK_DIR=android/SherpaOnnxSimulateStreamingAsr/app/build/outputs/apk/release APK_OUT=$(find "$APK_DIR" -maxdepth 1 -type f -name '*-unsigned.apk' -print -quit) if [ ! -f "$APK_OUT" ]; then echo "Error: no unsigned APK found in $APK_DIR" exit 1 fi mv "$APK_OUT" "./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-simulated_streaming_asr-$lang-$short_name.apk"• We ran a quick search in
android/SherpaOnnxSimulateStreamingAsr/app/build.gradle*and found nosplits { abi… }orabiFilters, so there’s only one*-unsigned.apktoday.
• If you add ABI splits or filters later, consider failing on >1 match or iterating over all outputs. [optional_refactors_recommended]scripts/apk/build-apk-asr.sh.in (1)
88-88: Verify APK output naming stability
- Our quick check did not find any
*-unsigned.apkunderandroid/SherpaOnnx/app/build/outputs/apk/release—please confirm thatapp-release-unsigned.apkis always generated there afterassembleRelease.- No
splits { abi… }orabiFilterssettings were detected in theandroidmodules—ensure there are no ABI splits, product flavors, or customoutputFileNamerules that could alter the artifact name.If you expect any variation in the APK filename, consider resolving it dynamically:
- mv android/SherpaOnnx/app/build/outputs/apk/release/app-release-unsigned.apk \ + APK_OUT=$(ls -1 android/SherpaOnnx/app/build/outputs/apk/release/*-unsigned.apk | head -n 1) + if [[ -z "$APK_OUT" || ! -f "$APK_OUT" ]]; then + echo "Error: unsigned APK not found" + exit 1 + fi + mv "$APK_OUT" \ ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-asr-$lang-$short_name.apkscripts/apk/build-apk-asr-2pass.sh.in (1)
110-110: Dynamically resolve unsigned APK output pathTo prevent future failures if AGP changes the output layout or introduces build splits, replace the hard-coded APK filename with a runtime lookup.
Affected file:
- scripts/apk/build-apk-asr-2pass.sh.in (around line 110)
Suggested change:
- mv android/SherpaOnnx2Pass/app/build/outputs/apk/release/app-release-unsigned.apk \ - ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-asr_2pass-$lang1-${short_name1}_${short_name2}.apk + mv "$APK_OUT" \ + ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-asr_2pass-$lang1-${short_name1}_${short_name2}.apkAdd immediately after the Gradle assembleRelease step:
APK_OUT=$(ls -1 android/SherpaOnnx2Pass/app/build/outputs/apk/release/*-unsigned.apk | head -n1) test -n "$APK_OUT" && test -f "$APK_OUT"Please build the release variant locally and verify that the glob (
*-unsigned.apk) matches the actual output file before committing.scripts/apk/build-apk-audio-tagging-wearos.sh.in (1)
81-81: Prefer dynamic APK discovery (including architecture) beforemvto handle AGP filename changesThe hard-coded path may break if AGP tweaks the output name. Since there are no ABI splits configured, we can glob on
*-${arch}-unsigned.apkand fall back if nothing matches. Please verify this on your CI environment.• File:
scripts/apk/build-apk-audio-tagging-wearos.sh.in
• Line: 81- mv android/SherpaOnnxAudioTaggingWearOs/app/build/outputs/apk/release/app-release-unsigned.apk \ - ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-audio-tagging-$short_name-wearos.apk + APK_OUT=$(ls -1 \ + android/SherpaOnnxAudioTaggingWearOs/app/build/outputs/apk/release/*-${arch}-unsigned.apk \ + | head -n1) + if [ -z "$APK_OUT" ] || [ ! -f "$APK_OUT" ]; then + echo "ERROR: unsigned APK not found (searched for *-${arch}-unsigned.apk)" >&2 + exit 1 + fi + mv "$APK_OUT" \ + ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-audio-tagging-$short_name-wearos.apk• Quick scan showed no
abiFiltersorsplits { abi … }in the Android module, so this glob will match the single unsigned APK.
• Action: Please confirm that this pattern reliably locates the unsigned APK in your build pipeline.scripts/apk/build-apk-slid.sh.in (1)
84-84: Guard APK output path dynamicallyMinor robustness improvement: derive the unsigned APK file name instead of hardcoding it.
Files to update:
scripts/apk/build-apk-slid.sh.inChanges needed:
After the
assembleReleaseinvocation, insert:APK_OUT=$(ls -1 android/SherpaOnnxSpokenLanguageIdentification/app/build/outputs/apk/release/*-unsigned.apk) if [ -z "$APK_OUT" ]; then echo "Error: unsigned APK not found" >&2 exit 1 fiOn line 84 (the
mvcommand), replace the hardcoded path:- mv android/SherpaOnnxSpokenLanguageIdentification/app/build/outputs/apk/release/app-release-unsigned.apk \ - ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-slid-$short_name.apk + mv "$APK_OUT" \ + ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-slid-$short_name.apkNote: Searching under
android/forabiFiltersorsplits { abireturned no results, so currently only one*-unsigned.apkis produced. If ABI splits are ever added, you’ll need to refine the glob or selection logic to handle multiple outputs.Please verify after a release build that
APK_OUTcorrectly matches the actual artifact name.scripts/apk/build-apk-speaker-identification.sh.in (2)
72-72: PreferassembleDebugoverbuildfor precision and speed
./gradlew buildruns more tasks than needed (incl. tests), and may assemble other variants.assembleDebugis faster and aligns with the debug APK you package below.Apply this diff:
- ./gradlew build + ./gradlew assembleDebug
75-75: Confirm intent to ship a debug-signed APKYou’re packaging
app-debug.apk, which is debug-signed and installable (good for fixing install errors). Just confirm this variant choice is intentional for speaker identification while other scripts use release-unsigned.scripts/apk/build-apk-vad.sh (1)
61-64: LGTM: Release build and new outputs pathUsing
assembleReleaseand moving fromintermediatestooutputsaligns with modern AGP behavior.As a minor optimization, consider excluding non-essential tasks to speed packaging (example:
./gradlew assembleRelease -x lint -x test) if CI time is a concern.scripts/apk/build-apk-kws.sh (1)
80-84: Optional: guard the artifact move to improve robustness across AGP versionsIn case AGP/Gradle alters output locations, consider globbing or finding the latest debug APK to avoid brittle paths.
Example:
apk_path=$(ls -1 android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk 2>/dev/null || true) test -f "$apk_path" || { echo "APK not found"; exit 1; } mv "$apk_path" "./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-<desc>.apk"Replace as appropriate for each loop.
Also applies to: 141-145
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (13)
scripts/apk/build-apk-asr-2pass.sh.in(1 hunks)scripts/apk/build-apk-asr.sh.in(1 hunks)scripts/apk/build-apk-audio-tagging-wearos.sh.in(1 hunks)scripts/apk/build-apk-audio-tagging.sh.in(1 hunks)scripts/apk/build-apk-kws.sh(2 hunks)scripts/apk/build-apk-slid.sh.in(1 hunks)scripts/apk/build-apk-speaker-diarization.sh.in(1 hunks)scripts/apk/build-apk-speaker-identification.sh.in(1 hunks)scripts/apk/build-apk-tts-engine.sh.in(1 hunks)scripts/apk/build-apk-tts.sh.in(1 hunks)scripts/apk/build-apk-vad-asr-simulate-streaming.sh.in(1 hunks)scripts/apk/build-apk-vad-asr.sh.in(1 hunks)scripts/apk/build-apk-vad.sh(2 hunks)
🔇 Additional comments (11)
scripts/apk/build-apk-vad-asr-simulate-streaming.sh.in (1)
106-106: Dropping per-ABI Gradle flag looks fineUsing assembleRelease without -Pandroid.injected.build.abi relies on per-arch jniLibs population (as you already do). That should still yield single-ABI APKs per loop iteration. No objections here.
scripts/apk/build-apk-asr.sh.in (1)
85-85: assembleRelease without ABI injection is reasonableGiven you copy only one ABI’s .so files per iteration, dropping -Pandroid.injected.build.abi should still produce per-ABI APKs. This aligns with the revert goal and removes the signing dependency.
scripts/apk/build-apk-asr-2pass.sh.in (1)
107-107: LGTM on reverting ABI injectionassembleRelease without per-ABI override should still yield per-ABI APKs per loop, given the jniLibs staging you already do. This supports the revert intent cleanly.
scripts/apk/build-apk-audio-tagging-wearos.sh.in (1)
78-78: assembleRelease change aligns with the revert and is fineRemoving ABI injection here is consistent with the other scripts and with per-arch jniLibs handling. No issues spotted.
scripts/apk/build-apk-slid.sh.in (1)
81-81: assembleRelease without ABI param: OKGiven the per-arch library copy pattern, this should still result in per-ABI APKs and removes the need for ABI injection. Looks good.
scripts/apk/build-apk-audio-tagging.sh.in (2)
77-77: LGTM: Dropped per-ABI Gradle paramUsing plain
./gradlew assembleReleaseis fine given you inject per-arch libs underjniLibs/$archbefore building.
80-80: Verified AGP output layout — no legacy references remainNo occurrences of
android.injected.build.abiorintermediates/apk/releasewere found, and all APK move commands now consistently usebuild/outputs/apk/.... LGTM.scripts/apk/build-apk-vad.sh (1)
104-107: LGTM: Consistent update for ten-vad variantSame rationale as above — looks correct and consistent for the second variant.
scripts/apk/build-apk-vad-asr.sh.in (1)
86-89: LGTM: Assemble release + outputs pathThe switch to
assembleReleaseand the updated APK path tooutputs/apk/releaseare correct.scripts/apk/build-apk-tts-engine.sh.in (1)
139-142: LGTM: Assemble release and updated APK output pathThis aligns with the revert and matches AGP’s
outputs/apk/releasestructure.scripts/apk/build-apk-speaker-diarization.sh.in (1)
79-79: LGTM on switching to a debug artifact pathThis aligns with generating an installable APK without manual signing. Once assembleDebug is used (above), this path is correct.
| sed -i.bak s/2048/9012/g ./gradle.properties | ||
| git diff ./gradle.properties | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew assembleRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Release build will yield an unsigned APK; prefer debug to fulfill the “no signing needed” objective
To avoid installation failures and keep behavior consistent with the diarization script, assemble the debug variant.
Apply:
- ./gradlew assembleRelease
+ ./gradlew assembleDebug📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ./gradlew assembleRelease | |
| ./gradlew assembleDebug |
🤖 Prompt for AI Agents
In scripts/apk/build-apk-kws.sh around line 80, the script calls ./gradlew
assembleRelease which produces an unsigned release APK and can cause install
failures; change this to assemble the debug variant by replacing that call with
./gradlew assembleDebug so the produced APK is signed with the debug key and
requires no manual signing, matching the diarization script behavior.
| popd | ||
|
|
||
| mv android/SherpaOnnxKws/app/build/intermediates/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-zh-wenetspeech-zipformer.apk | ||
| mv android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-zh-wenetspeech-zipformer.apk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update APK path to the debug artifact if switching to assembleDebug
Match the path to the debug build output.
Apply:
- mv android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-zh-wenetspeech-zipformer.apk
+ mv android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-zh-wenetspeech-zipformer.apk🤖 Prompt for AI Agents
In scripts/apk/build-apk-kws.sh around line 83, the script moves the release
unsigned APK but the build was switched to assembleDebug; update the destination
path to point to the debug artifact under build/outputs/apk/debug (replace
android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk
with android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk) and keep
the same target filename pattern
(./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-zh-wenetspeech-zipformer.apk).
| sed -i.bak s/2048/9012/g ./gradle.properties | ||
| git diff ./gradle.properties | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew assembleRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Same here: assembleDebug to avoid signing-related failures
Mirror the change for the English model loop.
Apply:
- ./gradlew assembleRelease
+ ./gradlew assembleDebug📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ./gradlew assembleRelease | |
| ./gradlew assembleDebug |
🤖 Prompt for AI Agents
In scripts/apk/build-apk-kws.sh around line 141, change the Gradle task from
assembleRelease to assembleDebug to avoid signing-related failures; replace the
./gradlew assembleRelease call with ./gradlew assembleDebug at this location and
mirror the same replacement in the English model loop elsewhere in the script so
both loops build debug APKs instead of release ones.
| popd | ||
|
|
||
| mv android/SherpaOnnxKws/app/build/intermediates/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk | ||
| mv android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Match the debug APK path in the second loop
Use the debug artifact path for consistency and installability.
Apply:
- mv android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk
+ mv android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| mv android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk | |
| mv android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-kws-en-gigaspeech-zipformer.apk |
🤖 Prompt for AI Agents
In scripts/apk/build-apk-kws.sh around line 144, the mv command moves the
release unsigned APK but the second loop should use the debug artifact path for
consistency and installability; change the source path from
android/SherpaOnnxKws/app/build/outputs/apk/release/app-release-unsigned.apk to
the debug artifact path
android/SherpaOnnxKws/app/build/outputs/apk/debug/app-debug.apk (keep the
destination filename pattern the same).
|
|
||
| pushd ./android/SherpaOnnxSpeakerDiarization | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using “gradlew build” may still trigger release tasks (and signing); use assembleDebug
gradlew build typically depends on assemble for all build types, which can invoke assembleRelease and reintroduce signing requirements. Use assembleDebug to ensure only a debug-signed, installable APK is produced.
Apply:
- ./gradlew build
+ ./gradlew assembleDebug📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ./gradlew build | |
| ./gradlew assembleDebug |
🤖 Prompt for AI Agents
In scripts/apk/build-apk-speaker-diarization.sh.in around line 76, the script
runs "./gradlew build" which can trigger release tasks and signing; replace that
invocation with "./gradlew assembleDebug" so only a debug-signed installable APK
is produced. Update the line to call assembleDebug and ensure any downstream
steps that expect the APK path point to the debug APK output directory.
| sed -i.bak s/2048/9012/g ./gradle.properties | ||
| git diff ./gradle.properties | ||
| ./gradlew assembleRelease -Pandroid.injected.build.abi=$arch | ||
| ./gradlew assembleRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Release build here still requires manual signing; prefer debug to meet the “install without signing” goal
assembleRelease produces an unsigned APK. To actually fix the installation error without introducing signing requirements, switch to assembleDebug (consistent with the diarization script’s direction).
Apply:
- ./gradlew assembleRelease
+ ./gradlew assembleDebugIf you intentionally want release unsigned artifacts, please confirm and we can instead add an apksigner step using the debug keystore.
🏁 Script executed:
#!/bin/bash
# Display lines around 133 in the TTS build script
sed -n '120,150p' scripts/apk/build-apk-tts.sh.in
# Check for any existing use of assembleDebug in APK scripts
rg -n 'assembleDebug' -g 'scripts/apk/*'Length of output: 919
Use a debug build to auto-sign the APK for immediate installation
The current assembleRelease step produces an unsigned APK (app-release-unsigned.apk), which won’t install without manual signing. Switching to assembleDebug yields a debug‐signed APK that can be installed out-of-the-box.
Please update scripts/apk/build-apk-tts.sh.in as follows:
- Replace the release assemble step
- Update the APK path in the
mvcommand
- ./gradlew assembleRelease
+ ./gradlew assembleDebug
- mv android/SherpaOnnxTts/app/build/outputs/apk/release/app-release-unsigned.apk \
- ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk
+ mv android/SherpaOnnxTts/app/build/outputs/apk/debug/app-debug.apk \
+ ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apkIf you instead need an unsigned release artifact, let me know and we can add an apksigner step using the debug keystore.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ./gradlew assembleRelease | |
| ./gradlew assembleDebug | |
| mv android/SherpaOnnxTts/app/build/outputs/apk/debug/app-debug.apk \ | |
| ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk |
🤖 Prompt for AI Agents
In scripts/apk/build-apk-tts.sh.in at line 133, replace the release assemble
step and move target so the script builds and uses the debug-signed APK; change
the gradle task from ./gradlew assembleRelease to ./gradlew assembleDebug and
update the subsequent mv command to reference the debug APK path (e.g.
app/build/outputs/apk/debug/app-debug.apk) instead of the release-unsigned APK
so the produced APK is debug-signed and installable immediately.
| popd | ||
|
|
||
| mv android/SherpaOnnxTts/app/build/intermediates/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk | ||
| mv android/SherpaOnnxTts/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
APK path should match the selected build type
If switching to assembleDebug per the previous comment, this path must point to the debug artifact.
Apply:
- mv android/SherpaOnnxTts/app/build/outputs/apk/release/app-release-unsigned.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk
+ mv android/SherpaOnnxTts/app/build/outputs/apk/debug/app-debug.apk ./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apkOptionally make this more robust across AGP versions by searching for the artifact:
apk_path=$(ls -1 android/SherpaOnnxTts/app/build/outputs/apk/debug/app-debug.apk 2>/dev/null || true)
test -f "$apk_path" || { echo "APK not found"; exit 1; }
mv "$apk_path" "./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk"🤖 Prompt for AI Agents
In scripts/apk/build-apk-tts.sh.in around line 136, the mv command references
the release APK while the build now uses the debug variant; update the path to
point to the debug artifact
(android/SherpaOnnxTts/app/build/outputs/apk/debug/app-debug.apk) or,
preferably, implement a robust lookup that finds the debug APK (e.g., assign
apk_path by checking the expected debug location(s), verify the file exists, and
then mv that resolved path to
./apks/sherpa-onnx-${SHERPA_ONNX_VERSION}-$arch-$lang-tts-$model_dir.apk),
exiting with an error if no APK is found.
Revert #2488 since it needs to sign the APK.
Fix the following installation error:

Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Behavior Changes
Chores