שילוב של Android Frame Pacing במעבד ה-OpenGL
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במדריך הזה מוסבר איך לשלב את Android Frame Pacing בשרשרת הכלים, איך להשתמש בפונקציות שהספרייה מספקת ואיך לוודא שהשיפור ב-Frame Pacing אכן התרחש. התכונה Android Frame Pacing זמינה כספרייה סטטית או משותפת בספריות AGDK.
שנתחיל?
- משכפלים את מאגר
games-samples
.
- פועלים לפי ההוראות שבקטע דרישות מוקדמות בקובץ ה-README של AGDKTunnel.
מריצים את הדוגמה AGDKTunnel ב-Android Studio. בפרויקט לדוגמה הזה משולב Android Frame Pacing במשחק שמשתמש ב-OpenGL ES לרינדור.
- פותחים את Android Studio.
- לוחצים על Projects > Open (פרויקטים > פתיחה) ובוחרים את הספרייה
/games-samples/agdk/agdktunnel
.
- ממתינים ש-Android Studio יסנכרן את הפרויקט.
- כדי להריץ את הדוגמה, צריך לחבר מכשיר או ליצור מכשיר וירטואלי (למידע נוסף, אפשר לעיין במאמר איך ליצור ולהריץ את האפליקציה).
- בוחרים את מכשיר היעד ולוחצים על הפעלה
.
חבילת ה-APK לדוגמה אמורה להיבנות ולהיות מותקנת במכשיר היעד. אם נתקלתם בשגיאות, כדאי לבדוק את הדברים הבאים:
- יש לך גרסה נתמכת של Android SDK. מידע נוסף זמין בשדה
compileSdkVersion
בקובץ build.gradle
של מודול האפליקציה. אפשר לעדכן את גרסת ה-SDK בכרטיסייה SDK Platforms ב-SDK Manager.
- יש לכם גרסה נתמכת של Android NDK. למידע נוסף, אפשר לעיין בשדה
ndkVersion
בקובץ build.gradle
של מודול האפליקציה. אפשר להתקין גרסה ספציפית של NDK מהכרטיסייה SDK Tools ב-SDK Manager.
- בקובץ
local.properties
בפרויקט לא מופיעה רשומה של ndk.dir
. המיקום הזה מצוין על ידי Android Studio ומשתמש בגרסת ה-NDK שצוינה למעלה. אם הרשומה הזו מופיעה, צריך למחוק את כל השורה.
- אחרי כל שינוי בהגדרות ה-build, צריך לנקות את הפרויקט (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**)."]]