淘汰項目

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

淘汰表示我們已終止對 API 的官方支援,但開發人員仍可繼續使用。本頁面列出這個 Android 版本中一些值得注意的淘汰項目。如要查看其他淘汰項目,請參閱 API 差異比較報表

改用 Spatializer 而非 Virtualizer

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.