תחילת העבודה עם Play Games Services למשחקים ל-Android
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
במדריך הזה מוסבר איך להגדיר פרויקט ב-Android Studio כך שישתמש ב-Play Games Services SDK. צריך להשלים את השלבים האלה לפני שמגדירים כניסה ל-Play Games Services ומוסיפים למשחק תכונות של Play Games Services.
לפני שמתחילים
כדי להכין את האפליקציה, מבצעים את השלבים שמפורטים בקטעים הבאים.
דרישות מוקדמות להתקנת האפליקציה
מוודאים שקובץ ה-build של האפליקציה משתמש בערכים הבאים:
minSdkVersion
של 19
או יותר
compileSdkVersion
של 28
או יותר
הגדרת המשחק ב-Google Play Console
ב-Google Play Console מנהלים את שירותי המשחקים של Google Play למשחק, ומגדירים את המטא-נתונים להרשאה ולאימות של המשחק. למידע נוסף, תוכלו לקרוא את המאמר הגדרת שירותי המשחקים של Play.
בקובץ build.gradle
ברמת הפרויקט, צריך לכלול את מאגר Maven של Google ואת מאגר Maven המרכזי גם בקטע buildscript
וגם בקטע allprojects
:
buildscript {
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
מוסיפים את התלות של Google Play Services ב-Play Games SDK לקובץ ה-build של Gradle של המודול, שבדרך כלל נקרא
app/build.gradle
:
dependencies {
implementation "com.google.android.gms:play-services-games-v2:+"
}
אחרי ביצוע השלבים האלה, תצטרכו להגדיר כניסה כדי שהמשחק יוכל לגשת לתכונות של Play Games Services.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[],null,["# Get started with Play Games Services for Android games\n\n| **Note:** This guide is for the Play Games Services v2 SDK. For information on the previous version of this SDK, see the [Play Games Services v1\n| documentation](/games/pgs/v1/android).\n\nThis guide describes how to set up an Android Studio project to use the\nPlay Games Services SDK. You must complete these steps before you\nset up Play Games Services [sign-in](/games/pgs/android/android-signin) and add\nPlay Games Services features to your game.\n\nBefore you begin\n----------------\n\nTo prepare your app, complete the steps in the following sections.\n\n### App prerequisites\n\nMake sure that your app's build file uses the following values:\n\n- A `minSdkVersion` of `19` of higher\n- A `compileSdkVersion` of `28` or higher\n\n### Set up your game in Google Play Console\n\nThe Google Play Console is where you manage Google Play games services for your\ngame, and configure metadata for authorizing and authenticating your game. For\nmore information, see\n[Set Up Google Play Games Services](/games/pgs/console/setup).\n\nConfigure your app\n------------------\n\nIn your project-level `build.gradle` file, include\n[Google's Maven repository](https://maven.google.com/web/index.html)\nand [Maven central repository](https://search.maven.org/artifact)\nin both your `buildscript` and `allprojects` sections: \n\n buildscript {\n repositories {\n google()\n mavenCentral()\n }\n }\n\n allprojects {\n repositories {\n google()\n mavenCentral()\n }\n }\n\nAdd the [Google Play services](https://developers.google.com/android)\ndependency for the Play Games SDK to your\n[module's Gradle build file](/studio/build#module-level), which is commonly\n\n`app/build.gradle`: \n\n dependencies {\n implementation \"com.google.android.gms:play-services-games-v2:+\"\n }\n\nAfter completing these steps you must set up\n[sign-in](/games/pgs/android/android-signin)\nin order for the game to access Play Games Services features."]]