自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
附錄 C:Car UI Plugin API 的最低相容版本
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
原始設備製造商 (OEM) 應盡快改用最新版的 car-ui-lib-plugin-apis
(1.2.0 以上版本)。理想情況下,原始設備製造商不應提供使用舊版的任何外掛程式。
更新原因
透過 Java 8+ API 脫糖支援,舊版 Android 可支援 Java 8+ API。缺少 API 的實作項目會編譯至應用程式,而 APK 的位元組碼會重新編寫,以便參照實作項目,而非平台上的程式庫。
從 Car UI 程式庫外掛程式載入 UI 元件的 OEM 實作內容時,需要參照 car-ui-lib-plugin-apis
介面定義的方法。這些方法參照是在執行階段由應用程式建立至 Car UI 程式庫外掛程式,且預期在應用程式和外掛程式實作中,方法簽章會相同。
由於特定最低 SDK 級別的要求,某些建構系統會一律啟用 API 去糖化。car-ui-lib-plugin-apis
介面的去糖化方法簽章可能與未去糖化的原始設備製造商 (OEM) 外掛程式實作不符,導致外掛程式無法載入。
因此,使用 Google 內部建構系統編譯的部分 GAS 應用程式與 Car UI 程式庫外掛程式不相容。因此,我們已移除所有需要脫糖的 Java 8 (以上版本) API 依附元件。這項變更需要更新 car-ui-lib-plugin-apis
定義的介面 API。
OEM 外掛程式所需的步驟
請按照下列步驟更新 API:
更新外掛程式實作項目,以便使用最新版本的 car-ui-lib-plugin-apis
。如要取得最新版本 (1.2.0 以上),請參閱 Google 的 Maven 存放區。
更新外掛程式實作項目,以便實作 PluginFactoryOEMV4
介面。當元件由 OEM 外掛程式實作時,這項變更需要執行下列步驟。更新下列項目的 OEM 實作方式:
工具列,用於實作 ToolbarControllerOEMV2
。
內容清單項目,用於擴充 ContentListItemOEMV2
。
IME 搜尋結果處理,以擴充 ImeSearchInterfaceOEMV2
。
更新應用程式,以便使用最新版本的 Car UI Library。
如果未套用這項更新,會發生什麼事?
如果未為 OEM 外掛程式完成本頁提供的步驟,經過去除糖化的應用程式 (例如 Google Automotive Services (GAS)) 就無法載入 Car UI Library 外掛程式的實作項目,且不會透過外掛程式機制套用 OEM 自訂項目。
Car UI 程式庫的現有 RRO 自訂項目不會受到此問題影響,並且會照常執行。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-06-12 (世界標準時間)。
[[["容易理解","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-06-12 (世界標準時間)。"],[],[],null,["# Appendix C, minimum compatible version for Car UI Plugin API\n\nOEMs are expected to switch to the newest version of `car-ui-lib-plugin-apis`\n(1.2.0 or higher) as soon as possible. Ideally, OEMs shouldn't ship any plugin\nthat uses an older version.\n\nWhy this update?\n----------------\n\n[Java 8+](https://developer.android.com/studio/write/java8-support-table) APIs\nare supported for previous versions of Android through [Java 8+ API desugaring\nsupport](https://developer.android.com/studio/write/java8-support#library-desugaring).\nImplementations of missing APIs are compiled into apps and the byte code of APKs\nare rewritten to reference the implementations instead of the libraries on the\nplatform.\n\nLoading OEM implementations of UI components from a Car UI Library plugin\nrequires the referencing of methods defined by `car-ui-lib-plugin-apis`\ninterfaces. These method references are made from apps to Car UI Library plugins\nat runtime with the expectation that method signatures are identical in app and\nplugin implementations.\n\nSome build systems enable API desugaring at all times due to requirements of a\nspecific minimum SDK level. Desugared method signatures for\n`car-ui-lib-plugin-apis` interfaces may not match those in an OEM plugin\nimplementation that has not been desugared, which results in plugins failing to\nload.\n\nAs a result, some GAS apps compiled with the internal Google build system are\nincompatible with the Car UI Library plugin. Therefore, we've removed all\ndependencies on Java 8 (and higher) APIs that require desugaring. This change\nrequires updates to the API of the interfaces defined by\n`car-ui-lib-plugin-apis`.\n\nRequired steps for OEM plugins\n------------------------------\n\nFollow these steps to update your API:\n\n1. Update the plugin implementation to use the latest version of\n `car-ui-lib-plugin-apis`. To get the latest version of (1.2.0 or higher),\n see [Google's Maven\n Repository](https://maven.google.com/web/index.html#com.android.car.ui:car-ui-lib-plugin-apis).\n\n2. Update the plugin implementation to implement the `PluginFactoryOEMV4`\n interface. This change requires the following steps when a component is\n implemented by the OEM plugin. Update the OEM implementation of:\n\n 1. Toolbar, to implement `ToolbarControllerOEMV2`.\n\n 2. Content list items, to extend `ContentListItemOEMV2`.\n\n 3. IME search results handing, to extend `ImeSearchInterfaceOEMV2`.\n\n3. Update the app to use the latest version of the Car UI Library.\n\nWhat happens if this update is not applied?\n-------------------------------------------\n\nIf the steps provided on this page aren't completed for an OEM plugin, desugared\napps, such as the Google Automotive Services (GAS), fail to load implementations\nof the Car UI Library plugin and no OEM customizations are applied through the\nplugin mechanism.\n\nExisting RRO customizations for the Car UI Library are not affected by this\nissue and continue to perform as usual."]]