警告:Google Play 免安装体验将不再提供。自 2025 年 12 月起,将无法再通过 Google Play 发布免安装应用,并且所有 Google Play 服务免安装体验 API 将停止运行。Play 将不再通过任何机制向用户提供免安装应用。
自推出 Google Play Instant 以来,我们一直在不断投资改进生态系统,因此根据开发者的反馈做出了这项变更。
若要继续优化以促进用户增长,我们建议开发者使用深层链接将用户引导至其常规应用或游戏,并在适当的时候将用户重定向到特定历程或功能。
所有免安装游戏都必须支持使用 Google Play 游戏服务自动登录。使用 Google Play 游戏服务可提供一致的玩家 ID,供您从云端恢复保存的进度。
库对应用程序大小的影响
Google Play 游戏服务库对应用大小的影响取决于游戏引擎的运行环境是 Unity、Java 还是 Native。
Java
由于 ProGuard 知道使用了哪些类,因此对大小的影响微乎其微。
Unity
您可以使用官方 Google Play 游戏服务插件将游戏存档功能集成到 Unity 游戏中。 如果采用 ProGuard 建议,则大小的影响约为 200 KB。
原生
您可以使用 Native Play 游戏服务 SDK 将游戏存档功能集成到基于 Android NDK 构建的游戏中。
使用下面的常规 ProGuard 配置可删除该库所包含的大多数 Java 代码。使用此配置,您只需为 APK 增加约 250 KB,就可以实现 Play 游戏服务登录和游戏存档。
# The native PGS library wraps the Java PGS SDK using reflection.
-dontobfuscate
-keeppackagenames
# Needed for callbacks.
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
# Needed for helper libraries.
-keep class com.google.example.games.juihelper.** {
public protected *;
}
-keep class com.sample.helper.** {
public protected *;
}
# Needed for GoogleApiClient and auth stuff.
-keep class com.google.android.gms.common.api.** {
public protected *;
}
# Keep all of the "nearby" library, which is needed by the native PGS library
# at runtime (though deprecated).
-keep class com.google.android.gms.nearby.** {
public protected *;
}
# Keep all of the public PGS APIs.
-keep class com.google.android.gms.games.** {
public protected *;
}