將 Android Frame Pacing 整合至 OpenGL 轉譯器
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本教學課程說明如何將 Android Frame Pacing 整合至工具鏈、如何使用程式庫提供的函式,以及如何確認影格使用速度是否已改善。Android Frame Pacing 可在 AGDK 程式庫中以靜態或共用資料庫的形式取得。
開始使用
- 複製
games-samples
存放區。
- 請按照 AGDKTunnel README 的事前準備一節中的操作說明操作。
在 Android Studio 中執行 AGDKTunnel 範例。這個範例專案會將 Android Frame Pacing 整合到使用 OpenGL ES 進行轉譯的遊戲中。
- 開啟 Android Studio。
- 依序點選「Projects」>「Open」,然後選取
/games-samples/agdk/agdktunnel
目錄。
- 等待 Android Studio 同步處理專案。
- 連接裝置或建立虛擬裝置來執行範例 (詳情請參閱「建立並執行應用程式」)。
- 選取目標裝置,然後按一下「Run」
。
範例 APK 應該會在目標裝置上建構及安裝。如果發生錯誤,請確認下列項目:
- 您擁有 Android SDK 支援的版本;詳情請參閱應用程式模組
build.gradle
檔案中的 compileSdkVersion
欄位。您可以從 SDK Manager 的「SDK Platforms」分頁更新 SDK 版本。
- 您擁有 Android NDK 支援的版本;詳情請參閱應用程式模組
build.gradle
檔案中的 ndkVersion
欄位。您可以從 SDK Manager 的「SDK Tools」分頁安裝特定版本的 NDK。
- 專案中的
local.properties
檔案「並未」擁有 ndk.dir
的項目。這個位置是由 Android Studio 指定,且使用上述的 NDK 版本。如有這個項目,請清除這一整行。
- 在變更任何版本設定之後,請清理專案 (依序點選「Build」>「Clean Project」),然後重新整理已連結的 C++ 專案 (依序點選「Build」>「Refresh Linked C++ Projects」)。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-26 (世界標準時間)。
[null,null,["上次更新時間:2025-08-26 (世界標準時間)。"],[],[],null,["This tutorial describes how to integrate Android Frame Pacing into your\ntoolchain, how to use the functions that the library provides, and how to verify\nthat your frame pacing has improved. Android Frame Pacing is available as a\nstatic or shared library in the AGDK Libraries.\n\nGet started\n\n1. Clone the [`games-samples` repository](https://github.com/android/games-samples.git).\n2. Follow the instructions in the [prerequisites section of the AGDKTunnel README](https://github.com/android/games-samples/tree/main/agdk/agdktunnel#prerequisites).\n3. Run the [AGDKTunnel sample](https://github.com/android/games-samples/tree/main/agdk/agdktunnel) in Android Studio. This example\n project integrates Android Frame Pacing into a game that uses OpenGL ES for\n rendering.\n\n 1. Open Android Studio.\n 2. Click **Projects \\\u003e Open** and select the `/games-samples/agdk/agdktunnel` directory.\n 3. Wait for Android Studio to sync the project.\n 4. Connect a device or create a virtual device to run the sample (for more information, see [Build and run your app](/studio/run)).\n 5. Select the target device and click **Run** .\n 6. The sample APK should build and install on the target device. If you\n encounter errors, check the following:\n\n - You have a [supported version](/games/sdk#requirements) of the Android SDK; see the `compileSdkVersion` field in the app module `build.gradle` file for more information. You can [update the SDK version](/studio/intro/update#sdk-manager) from the **SDK Platforms** tab in the SDK Manager.\n - You have a [supported version](/games/sdk#requirements) of the Android NDK; see the `ndkVersion` field in the app module `build.gradle` file for more information. You can [install a specific version of the NDK](/studio/projects/install-ndk#specific-version) from the **SDK Tools** tab in the SDK Manager.\n - The `local.properties` file in the project does *not* have an entry for `ndk.dir`. This location is specified by Android Studio and uses the NDK version from above. If you have this entry, clear the entire line.\n - After any build setting change, clean the project (**Build \\\u003e Clean\n Project** ) and refresh the linked C++ projects (**Build \\\u003e Refresh\n Linked C++ Projects**)."]]