ผสานรวมการเว้นวรรคเฟรมของ Android เข้ากับโปรแกรมแสดงผล OpenGL
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
บทแนะนำนี้อธิบายวิธีผสานรวมการเว้นระยะเฟรมของ Android เข้ากับ
เครื่องมือเชน วิธีใช้ฟังก์ชันที่ไลบรารีมีให้ และวิธีตรวจสอบ
ว่าการเว้นระยะเฟรมดีขึ้นแล้ว Android Frame Pacing พร้อมใช้งานเป็น
ไลบรารีแบบคงที่หรือไลบรารีที่ใช้ร่วมกันใน AGDK Libraries
เริ่มต้นใช้งาน
- โคลนที่เก็บ
games-samples
- ทําตามวิธีการในส่วนข้อกําหนดเบื้องต้นของ README ของ AGDKTunnel
เรียกใช้ตัวอย่าง AGDKTunnel ใน Android Studio โปรเจ็กต์ตัวอย่างนี้
ผสานรวม Android Frame Pacing เข้ากับเกมที่ใช้ OpenGL ES สำหรับ
การแสดงผล
- เปิด Android Studio
- คลิกโปรเจ็กต์ > เปิด แล้วเลือกไดเรกทอรี
/games-samples/agdk/agdktunnel
- รอให้ Android Studio ซิงค์โปรเจ็กต์
- เชื่อมต่ออุปกรณ์หรือสร้างอุปกรณ์เสมือนเพื่อเรียกใช้ตัวอย่าง (ดูข้อมูลเพิ่มเติมได้ที่สร้างและเรียกใช้แอป)
- เลือกอุปกรณ์เป้าหมาย แล้วคลิกเรียกใช้

APK ตัวอย่างควรสร้างและติดตั้งในอุปกรณ์เป้าหมาย หากพบข้อผิดพลาด โปรดตรวจสอบสิ่งต่อไปนี้
- คุณมี Android SDK เวอร์ชันที่รองรับ
ดูข้อมูลเพิ่มเติมได้ที่ฟิลด์
compileSdkVersion
ในไฟล์ build.gradle
ของโมดูลแอป
คุณสามารถอัปเดตเวอร์ชัน SDK ได้จากแท็บแพลตฟอร์ม SDK ใน SDK Manager
- คุณมี Android NDK เวอร์ชันที่รองรับ
ดูข้อมูลเพิ่มเติมได้ที่ฟิลด์
ndkVersion
ในไฟล์โมดูลแอป
build.gradle
คุณสามารถติดตั้ง NDK เวอร์ชันที่ต้องการได้
จากแท็บเครื่องมือ SDK ใน SDK Manager
- ไฟล์
local.properties
ในโปรเจ็กต์ไม่มีรายการ
สำหรับ ndk.dir
Android Studio จะระบุตำแหน่งนี้และใช้
NDK เวอร์ชันจากด้านบน หากมีรายการนี้ ให้ล้างทั้งบรรทัด
- หลังจากเปลี่ยนการตั้งค่าบิลด์แล้ว ให้ล้างโปรเจ็กต์ (Build > Clean
Project) และรีเฟรชโปรเจ็กต์ C++ ที่ลิงก์ไว้ (Build > Refresh
Linked C++ Projects)
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-26 UTC
[null,null,["อัปเดตล่าสุด 2025-08-26 UTC"],[],[],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**)."]]