弃用

随着每个版本的发布,特定的 Android 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.