gpt4 book ai didi

android - 为什么我需要这些 proguard 规则用于 Google Play 服务

转载 作者:太空狗 更新时间:2023-10-29 15:44:23 26 4
gpt4 key购买 nike

我刚刚升级到最新的 google play 服务 (11.6.0)。当我使用混淆器构建时,我现在收到这些警告:

Warning: com.google.android.gms.gcm.zza: can't find referenced method 'android.app.NotificationChannel getNotificationChannel(java.lang.String)' in library class android.app.NotificationManager
Warning: com.google.android.gms.gcm.zza: can't find referenced class android.app.NotificationChannel
Warning: com.google.android.gms.gcm.zza: can't find referenced class android.app.NotificationChannel
Warning: com.google.android.gms.gcm.zza: can't find referenced method 'void createNotificationChannel(android.app.NotificationChannel)' in library class android.app.NotificationManager
Warning: com.google.android.gms.gcm.zza: can't find referenced method 'android.app.Notification$Builder setChannelId(java.lang.String)' in library class android.app.Notification$Builder
Warning: com.google.android.gms.internal.zzbga: can't find referenced method 'boolean isInstantApp()' in library class android.content.pm.PackageManager
Warning: com.google.android.gms.internal.zzbgb: can't find referenced method 'boolean isInstantApp(java.lang.String)' in library class android.content.pm.PackageManager

为什么我会看到这个?我认为 GMS 处理了它自己的 Proguard 规则。来自文档 link :

Note: ProGuard directives are included in the Play services client libraries to preserve the required classes. The Android Plugin for Gradle automatically appends ProGuard configuration files in an AAR (Android ARchive) package and appends that package to your ProGuard configuration. During project creation, Android Studio automatically creates the ProGuard configuration files and build.gradle properties for ProGuard use. To use ProGuard with Android Studio, you must enable the ProGuard setting in your build.gradle buildTypes. For more information, see the ProGuard guide.

最佳答案

根据 release notes for Google Play services 11.2.0 :

When you upgrade your app’s Play services dependencies to 11.2.0 or later, your app’s build.gradle must also be updated to specify a compileSdkVersion of at least 26 (Android O). This does not change the way your app runs.

更新您的compileSdkVersion(注意,您不需要同时更新您的targetSdkVersion - 这可以稍后完成)以便在API中添加的引用方法26, 可以找到。

关于android - 为什么我需要这些 proguard 规则用于 Google Play 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47759558/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com