自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
測試並偵錯
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
以下是幾項建議,可在您建立 VIA 程式碼時參考,以便更輕鬆地進行測試。
將程式碼集架構為獨立的單元
主要單位包括:
- 觸發條件。熱鍵、按壓通話 (PTT) 和輕觸通話 (TTT)。
- 語音辨識:著重於將音訊串流轉換為結構化資料。
- 指令執行。專注於處理查詢,並將其轉換為動作。
每個層級都應可單獨測試,且彼此獨立。請納入並記錄下列資訊:
- 意圖額外資訊,可用於將使用者查詢直接傳遞至指令執行層。這樣一來,原始設備製造商和整合商就能直接略過語音辨識,並測試指令執行 (汽車整合)。
- 將預錄音訊檔案傳送至語音互動服務的程序,可讓系統自行測試語音辨識功能,而無須使用車輛麥克風。
用於測試的模擬器
Android Emulator 是開發和測試的絕佳平台,因為它可在主機麥克風和客體 AAOS 例項之間建立橋接。

圖 1. 模擬器測試
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],[],null,["# Test and debug\n\nFollowing are several recommendations to consider as you structure your VIA\ncode to make it easier to test.\n\nArchitect the code base into independent units\n----------------------------------------------\n\nPrimary units include:\n\n- **Triggering.** Hotwording, Push-to-Talk (PTT) and Tap-to-Talk (TTT).\n- **Voice recognition.** Focused on converting audio streams into structured data.\n- **Command fulfillment.** Focused into processing a query and translate it into an action.\n\nEach of these layers should be testable on its own and independent from each\nother. Include and document:\n\n- Intent extras that can be used to pass user queries directly to the command fulfillment layer. This would allow OEMs and integrators to skip the voice recognition and test command fulfillment (car integrations) directly.\n- A process to pass prerecorded audio files into the Voice Interaction service, allowing to test voice recognition on its own, skipping the vehicle microphone.\n\nEmulator for testing\n--------------------\n\n[Android\nEmulator](https://developer.android.com/studio/run/emulator) is an excellent platform for development and testing as it provides bridging\nbetween the host microphone and the guest AAOS instance.\n\n**Figure 1.** Emulator testing"]]