淘汰項目

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

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

使用 Spatializer 取代 Virtualizer

First added in Android 12 (API level 32), the Spatializer class lets apps query the capabilities and behavior of sound spatialization on the device. In Android 15, the Virtualizer class is deprecated. Use AudioAttributes.Builder.setSpatializationBehavior instead to characterize how you want your content to be played when spatialization is supported.

AndroidX media3 ExoPlayer 1.0 enables spatial audio by default for multichannel audio when the device supports it. See this recent blog post and the spatial audio documentation for more information, including APIs to control the feature.

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.