我有一个Android项目(目标= Google API:17)。 我正在使用Proguard,一切正常,直到我添加google-play-services库作为依赖项。 现在我收到以下错误:
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)
我尝试了一切,没有发生任何事情:(
这是我的proguard cfg文件:
-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
请帮我这个,
感谢。
答案 0 :(得分:10)
如果您使用Android Studio,则包含ProGuard指令
注意:ProGuard指令包含在Play服务客户端库中以保留所需的类。用于Gradle的Android插件会自动将ProGuard配置文件附加到AAR(Android ARchive)包中,并将该包附加到ProGuard配置中。在项目创建期间,Android Studio会自动为ProGuard创建ProGuard配置文件和build.gradle属性。要在Android Studio中使用ProGuard,必须在build.gradle buildTypes中启用ProGuard设置。有关更多信息,请参阅ProGuard主题。
答案 1 :(得分:8)
您未包含Google Play服务Proguard例外: http://developer.android.com/google/play-services/setup.html#Proguard