Proguarding Google Play Services 7.+ 导致 com.google.android.gms.internal.zzig:找不到引用的方法 'boolean isAtt

Posted

技术标签:

【中文标题】Proguarding Google Play Services 7.+ 导致 com.google.android.gms.internal.zzig:找不到引用的方法 \'boolean isAttachedToWindow()\'【英文标题】:Proguarding Google Play Services 7.+ results in com.google.android.gms.internal.zzig: can't find referenced method 'boolean isAttachedToWindow()'Proguarding Google Play Services 7.+ 导致 com.google.android.gms.internal.zzig:找不到引用的方法 'boolean isAttachedToWindow()' 【发布时间】:2015-08-18 03:15:23 【问题描述】:

我有一个接近 65K 方法计数限制的应用。我目前正在使用没有混淆的 Proguard

# This is a configuration (rules) file for ProGuard.
-dontobfuscate
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers

# Dex does not like code run through the ProGuard optimize and preverify steps
# (and performs some of these optimizations on its own).
-dontpreverify
-dontoptimize
-verbose

# Only run ProGuard shrinking against Google Play Services (package = com.google.android.gms.*)
-keep class !com.google.** (also tried !com.google.android.** / !com.google.android.gms.**)
-dontwarn !com.google.** (also tried !com.google.android.** / !com.google.android.gms.**)

去除其依赖项中未使用的方法:

compile 'com.google.android.gms:play-services-base:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'

但是,$ ./gradlew assemble 给出以下错误:

:proguardGoogleDebug
Warning: com.google.android.gms.internal.zzig: can't find referenced method 'boolean isAttachedToWindow()' in program class com.google.android.gms.internal.zzig
Warning: there were 1 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
:proguardGoogleDebug FAILED
FAILURE: Build failed with an exception.

以前有人解决过这个问题吗?提前致谢。

【问题讨论】:

【参考方案1】:

确保您的 compileSDK >= 19。View#isAttachedToWindow 是在 19 中添加的。

【讨论】:

以上是关于Proguarding Google Play Services 7.+ 导致 com.google.android.gms.internal.zzig:找不到引用的方法 'boolean isAtt的主要内容,如果未能解决你的问题,请参考以下文章

google play 手机上下载的apk安装包文件存在哪里?怎么删除?

Google Play 服务 - Google 登录会产生网络错误

Google Play 排行榜说明

.Net - Google Play 下载销售报告

Google Play 应用签名和即时应用

实施 Google Play 游戏服务 - 如何让用户登录