Proguarding Google Play Services 7.+ results in can't find referenced method 'boolean isAttachedToWindow()'


I have an app that is close to the 65K method count limit. I'm currently using Proguard without obfuscation

# This is a configuration (rules) file for ProGuard.

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

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

to strip out unused methods in its dependencies:

compile ''
compile ''
compile ''
compile ''
compile ''

However, $ ./gradlew assemble gives the following error:

Warning: can't find referenced method 'boolean isAttachedToWindow()' in program class
Warning: there were 1 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
:proguardGoogleDebug FAILED
FAILURE: Build failed with an exception.

Has anyone troubleshooted this issue before? Thanks in advance.

Make sure you are compileSDK is >= 19. View#isAttachedToWindow was added in 19.

By : Karthik

This video can help you solving your question :)
By: admin