Proguard with google-play services

I have an Android project (target = Google API: 17). I use Proguard and everything works fine until I added the google-play-services library as a dependency. Now I get the following error:

java.lang.IllegalArgumentException: Value is not a reference value [proguard.evaluation.value.InstructionOffsetValue] at proguard.evaluation.value.Value.referenceValue(Value.java:97) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.isPoppingSimpleEnum(SimpleEnumUseSimplifier.java:530) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.isPoppingSimpleEnum(SimpleEnumUseSimplifier.java:520) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.visitVariableInstruction(SimpleEnumUseSimplifier.java:229) at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306) at proguard.optimize.evaluation.SimpleEnumUseSimplifier.visitCodeAttribute(SimpleEnumUseSimplifier.java:131) at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101) at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79) at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95) at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91) at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71) at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:504) at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47) at proguard.classfile.ProgramClass.accept(ProgramClass.java:346) at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124) at proguard.optimize.Optimizer.execute(Optimizer.java:373) at proguard.ProGuard.optimize(ProGuard.java:306) at proguard.ProGuard.execute(ProGuard.java:115) at proguard.ProGuard.main(ProGuard.java:483) 

I tried everything and nothing happened :(

Here is my cfg proguard file:

 -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -dontwarn android.support.** -dontwarn org.apache.commons.codec.binary.** -dontwarn com.google.common.collect.Maps -keepclassmembers class * { native <methods>; } -keepclassmembers class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclassmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keepclassmembers class **.R$* { public static <fields>; } -keep class **.R$* -keepattributes *Annotation* -keep class com.tjeannin.apprate.** { *; } -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt -keep class com.aviary.android.feather.headless.AviaryEffect -keep class com.aviary.android.feather.headless.media.ExifInterfaceWrapper -keep class com.aviary.android.feather.headless.moa.Moa -keep class com.aviary.android.feather.headless.moa.MoaResult -keep class com.aviary.android.feather.headless.moa.MoaHD -keep class com.aviary.android.feather.headless.filters.NativeFilterProxy -keep class com.aviary.android.feather.headless.utils.CameraUtils -keep class com.aviary.android.feather.headless.gl.GLUtils -keep class com.aviary.android.feather.opengl.AviaryGLSurfaceView -keep class com.aviary.android.feather.widget.ScrollerRunnable -keep class com.aviary.android.feather.library.services.BaseContextService -keep class it.sephiroth.android.library.imagezoom.easing.Easing -keep class com.aviary.android.feather.library.external.tracking.TrackerFactory -keep class com.aviary.android.feather.library.tracking.AbstractTracker -keep interface com.aviary.android.feather.library.services.IAviaryController -keep interface com.aviary.android.feather.headless.filters.IFilter -keep interface com.aviary.android.feather.widget.ScrollerRunnable$ScrollableView -keep class * extends com.aviary.android.feather.library.tracking.AbstractTracker -keep class * extends com.aviary.android.feather.headless.filters.IFilter -keep class * extends com.aviary.android.feather.headless.filters.INativeFilter -keep class * implements com.aviary.android.feather.library.services.IAviaryController -keep class * extends com.aviary.android.feather.library.services.BaseContextService -keep class * implements com.aviary.android.feather.widget.ScrollerRunnable$ScrollableView { *; } -keep class * implements java.lang.Runnable -keepclasseswithmembers class * { protected <init>( com.aviary.android.feather.library.services.BaseContextService ); } -keepclasseswithmembers class * { public <init>( com.aviary.android.feather.library.services.IAviaryController ); } -keepclassmembers class com.aviary.android.feather.library.tracking.AbstractTracker { *; } -keepclassmembers interface it.sephiroth.android.library.imagezoom.easing.Easing { *; } -keepclassmembers class com.aviary.android.feather.library.external.tracking.TrackerFactory { *; } -keepclassmembers class * implements it.sephiroth.android.library.imagezoom.easing.Easing { *; } # This class should not be obfuscated at all -keepclassmembers class com.aviary.android.feather.headless.moa.MoaResult { public java.lang.String inputString; public android.graphics.Bitmap inputBitmap; public java.lang.String outputString; public android.graphics.Bitmap outputBitmap; public volatile int active; public void cancel(); public synchronized void execute(); } # Keep all classes with a native method -keepclassmembers class * { public static native <methods>; private static native <methods>; static native <methods>; private native <methods>; native <methods>; } -keepattributes Signature 

Please help me with this,

Thanks.

+6
source share
2 answers

If you are using Android Studio, ProGuard directives are included.

Note. ProGuard directives are included in the Play client libraries to preserve the required classes. The Android plugin for Gradle automatically adds the ProGuard configuration files in the AAR package (Android ARchive) and adds this package to your ProGuard configuration. During project creation, Android Studio automatically creates ProGuard configuration files and build.gradle properties to use ProGuard. To use ProGuard with Android Studio, you must enable the ProGuard parameter in buildGyple buildTypes. See the ProGuard Section for more information.

Help: Setting up Google Play Services

+8
source

You have not enabled Google Play Proguard exceptions: http://developer.android.com/google/play-services/setup.html#Proguard

+7
source

All Articles