淘汰項目

每次發布版本時,特定的 Android API 可能會過時或必須重構,以提供更優質的開發人員體驗或支援新的平台功能。在這種情況下,我們會正式淘汰過時的 API,並引導開發人員改用替代的 API。

淘汰意味著我們已終止對 API 的官方支援,但開發人員仍可以繼續使用這些 API。本頁重點介紹這個版本的 Android 有哪些值得注意的淘汰功能。如要查看其他淘汰項目,請參閱 API 差異比較表

使用空間化工具,而非虛擬化工具

Spatializer 類別首次在 Android 12 (API 級別 32) 中新增,可讓應用程式查詢裝置上的音效空間化功能和行為。在 Android 15 中,我們已淘汰 Virtualizer 類別。在支援空間化的情況下,請改用 AudioAttributes.Builder.setSpatializationBehavior 描述您希望的內容播放方式。

在裝置支援這項功能時,AndroidX media3 ExoPlayer 1.0 預設啟用多聲道音訊的空間音訊功能。詳情請參閱這篇近期網誌文章空間音訊說明文件,包括用於控管功能的 API。

Android WebView 中淘汰的 WebSQL

The setDatabaseEnabled and getDatabaseEnabled methods from WebSettings are now deprecated. These settings activated support for WebSQL inside Webview. WebSQL is now removed in Chrome and is now deprecated on Android Webview. These methods will become a no-op on all Android versions in the next 12 months.

The World Wide Web Consortium (W3C) encourages apps needing web databases to adopt Web Storage API technologies like localStorage and sessionStorage, or IndexedDB. SQLite Wasm in the browser backed by the Origin Private File System outlines a replacement set of technologies based on the SQLite database, compiled to Web Assembly (Wasm), and backed by the origin private file system to enable more direct migration of WebSQL code.