弃用
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
随着每个版本的发布,特定的 Android API 可能会过时或需要进行重构,以提供更好的开发者体验或支持新的平台功能。在这些情况下,我们会正式废弃过时的 API,并引导开发者改用替代 API。
废弃意味着我们已结束对这些 API 的正式支持,但它们将继续可供开发者使用。本页重点介绍此 Android 版本中废弃的一些 API。如需查看废弃的其他 API,请参阅 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
setDatabaseEnabled
和 getDatabaseEnabled
现已废弃 WebSettings
中的方法。这些设置已激活支持
并在 Webview 中
运行 WebSQLWebSQL 现已从 Chrome 中移除,并且在 Android WebView 中已废弃。在接下来的 12 个月内,这些方法在所有 Android 版本中都会变为免运维状态。
万维网联盟 (W3C) 鼓励需要 Web 数据库的应用采用 Web Storage API 技术,例如 localStorage 和 sessionStorage,或 IndexedDB。浏览器中由源私有文件系统支持的 SQLite Wasm 概述了基于 SQLite 数据库的一组替代技术,这些技术编译为 Web Assembly (Wasm),并由源私有文件系统支持,以实现更直接的 WebSQL 代码迁移。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):2025-08-27。"],[],[],null,["With each release, specific Android APIs might become obsolete or need to be\nrefactored to provide a better developer experience or support new platform\ncapabilities. In these cases, we officially deprecate the obsolete APIs and\ndirect developers to alternative APIs to use instead.\n\nDeprecation means that we've ended official support for the APIs, but they will\ncontinue to remain available to developers. This page highlights some of the\nnotable deprecations in this release of Android. To see other deprecations,\nrefer to the [API diff report](/sdk/api_diff/35/changes).\n\nUse Spatializer instead of Virtualizer\n\nFirst added in Android 12 (API level 32), the [`Spatializer`](/reference/android/media/Spatializer)\nclass lets apps query the capabilities and behavior of sound spatialization on\nthe device. In Android 15, the [`Virtualizer`](/reference/android/media/audiofx/Virtualizer) class is\ndeprecated. Use\n[`AudioAttributes.Builder.setSpatializationBehavior`](/reference/android/media/AudioAttributes.Builder#setSpatializationBehavior(int)) instead\nto characterize how you want your content to be played when spatialization is\nsupported.\n\nAndroidX media3 ExoPlayer 1.0 enables spatial audio by default for multichannel\naudio when the device supports it. See this\n[recent blog post](https://android-developers.googleblog.com/2023/04/delivering-immersive-sound-experience-with-spatial-audio.html) and the\n[spatial audio documentation](/media/grow/spatial-audio#exoplayer) for more information, including\nAPIs to control the feature.\n\nWebSQL deprecated in Android WebView\n\nThe [`setDatabaseEnabled`](/reference/android/webkit/WebSettings#setDatabaseEnabled(boolean)) and [`getDatabaseEnabled`](/reference/android/webkit/WebSettings#getDatabaseEnabled())\nmethods from `WebSettings` are now deprecated. These settings activated support\nfor WebSQL inside Webview. WebSQL is now removed in Chrome and is now deprecated\non Android Webview. These methods will become a no-op on all Android versions in\nthe next 12 months.\n\nThe World Wide Web Consortium (W3C) [encourages](https://www.w3.org/TR/webdatabase/#:%7E:text=The%20Web%20Applications%20Working%20Group%20continues%20work%20on%20two%20other%20storage%2Drelated%20specifications%3A%20Web%20Storage%20and%20Indexed%20Database%20API.)\napps needing web databases to adopt [Web Storage API](https://developer.mozilla.org/docs/Web/API/Web_Storage_API)\ntechnologies like [localStorage](https://developer.mozilla.org/docs/Web/API/Window/localStorage)\nand [sessionStorage](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage), or\n[IndexedDB](https://developer.mozilla.org/docs/Web/API/IndexedDB_API/Using_IndexedDB). [SQLite Wasm in the browser backed by the\nOrigin Private File System](https://developer.chrome.com/blog/sqlite-wasm-in-the-browser-backed-by-the-origin-private-file-system)\noutlines a replacement set of technologies based on the\n[SQLite](https://sqlite.org/) database,\n[compiled to Web Assembly](https://sqlite.org/wasm) (Wasm), and backed by the\n[origin private file system](https://developer.mozilla.org/docs/Web/API/File_System_Access_API#origin_private_file_system)\nto enable more [direct migration](https://developer.chrome.com/blog/from-web-sql-to-sqlite-wasm/)\nof WebSQL code."]]