淘汰項目
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
每個版本發布時,特定 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 已淘汰
WebSettings
的 setDatabaseEnabled
和 getDatabaseEnabled
方法現已淘汰。這些設定已啟用支援功能
適用於 WebView 中的 WebSQLWebSQL 現已從 Chrome 中移除,現已淘汰
Android WebView 的運作方式這些方法將在未來 12 個月內,在所有 Android 版本上變成無操作。
全球資訊網協會 (W3C) 鼓勵需要網頁資料庫的應用程式採用 Web Storage API 技術,例如 localStorage 和 sessionStorage,或 IndexedDB。瀏覽器中的 SQLite Wasm 由來源私人檔案系統支援概述了以 SQLite 資料庫為基礎的替代技術組合,並編譯為 Web Assembly (Wasm),並由來源私人檔案系統支援,以便進一步直接遷移 WebSQL 程式碼。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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."]]