從 Google Drive Android API 遷移
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
自 2018 年 12 月 6 日起,雲端硬碟 Android API 已淘汰,並將於 2023 年 2 月 1 日全面停用。
時間軸
日期 |
Drive Android API 狀態 |
2018 年 12 月 6 日 |
公開宣布淘汰。現有用戶端仍可正常存取 API,但應立即開始進行遷移作業。新用戶不得使用此 API。
|
2019 年 10 月 21 日 |
Google Play 服務 SDK 發布內容已移除 Drive Android API。您必須先移除 Drive Android API 依附元件,才能建構應用程式,但現有建構作業不會受到影響。Google 雲端硬碟 Android API 公開文件將不再提供。 |
2022 年 3 月 3 日 |
Google 雲端硬碟 Android API 已淘汰,所有 API 呼叫都無法運作。客戶必須在此日期前完成遷移。
|
2023 年 2 月 1 日 |
屆時,Android 版雲端硬碟 API 將全面停用,所有連線嘗試都會失敗。
|
使用 Drive REST API
雲端硬碟 REST API 提供與雲端硬碟 Android API 相同的功能,包括:
為簡化用戶端遷移作業,我們提供範例應用程式,展示上述每項建議的替代方案。此外,本文也會說明如何使用 REST API 建立、修改及查詢使用者的雲端硬碟檔案。如有任何問題,請查看 StackOverflow 上的 google-drive-api 標記。
遷移
由於 Google 雲端硬碟 Android API 已淘汰,所有 API 呼叫都無法運作,請確保應用程式不再呼叫該 API。如要這麼做,請移除初始化 API 的程式碼:addApi(Drive.API)
。
如果您未從 Drive Android API 遷移,且應用程式嘗試呼叫 API,系統會傳回下列錯誤訊息:
com.google.android.gms.common.api.ApiException: 17: API: Drive.API is not
available on this device. Connection failed with:
ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-04 (世界標準時間)。
[null,null,["上次更新時間:2025-08-04 (世界標準時間)。"],[],[],null,["# Migrate from the Google Drive Android API\n\n**The Drive Android API is deprecated as of December 6, 2018 and will be fully\nturned down on February 1, 2023**.\n\nTimeline\n--------\n\n| Date | Drive Android API status |\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| December 6, 2018 | Deprecation is [publicly announced](https://cloud.google.com/blog/products/application-development/sync-google-drive-files-to-apps-using-the-drive-rest-api-bidding-farewell-to-the-drive-android-api). Existing clients will be able to access the API normally, but should immediately commence with migration efforts. New clients must not use the API. |\n| October 21, 2019 | The Drive Android API is removed from the Google Play Services SDK distribution. Apps will be unable to build until removing the Drive Android API dependency, but existing builds will be unaffected. The Drive Android API public documentation will no longer be available. |\n| March 3, 2022 | The Drive Android API is deprecated and all API calls are non-operational. Clients must migrate by this date. |\n| February 1, 2023 | The Drive Android API will be fully turned down and all connection attempts will be unsuccessful. |\n\nUse the Drive REST API\n----------------------\n\nThe Drive REST API offers the same functionality as the Drive Android API,\nincluding ways to:\n\n- Share and collaborate as you expect from Drive. You can [manage permissions or prompt the Share dialog](/workspace/drive/api/guides/manage-sharing) to users as needed. The REST API also allows for commenting on files, allowing your app to interact with the conversation around a file.\n- Search for files using [`files.list`](/workspace/drive/api/v3/reference/files/list), based on traditional indexing or [your own customized, indexable text](/workspace/drive/api/guides/file).\n- Detect changes to files through the [Changes collection](/workspace/drive/api/v3/reference/changes) and to any shared with the user through [shared drives](/workspace/drive/api/guides/enable-shareddrives).\n- Export and convert Google Docs so that your app can easily [open a user's document](/workspace/drive/api/guides/integrate-open#specific).\n\nTo ease client migration efforts, a\n[sample app](https://github.com/googleworkspace/android-samples/tree/master/drive/deprecation) is provided which\ndemonstrates each of the proposed replacements above. It also shows how to\ncreate, modify, and query for a user's Drive files using the REST API. If you\nhave any issues, check out the\n[google-drive-api](https://stackoverflow.com/questions/tagged/google-drive-api?tab=Newest)\ntag on StackOverflow.\n\nMigration\n---------\n\nSince the Drive Android API is deprecated, and all API calls are\nnon-operational, make sure your app is no longer calling the API. To do this,\nremove the code that initializes the API: `addApi(Drive.API)`.\n\nIf you don't migrate from the Drive Android API, and your app attempts to call\nthe API, the following error message is returned:\n\n`com.google.android.gms.common.api.ApiException: 17: API: Drive.API is not\navailable on this device. Connection failed with:\nConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}`"]]