我在我的android应用程序中包括AdColony
,现在我试图用proguard导出我的应用程序。我在这里和这里找到了AdColony
的构型。我试图将它们分别包含在proguard.cfg中,但它不起作用。
配置:
-dontwarn android.webkit.**
# another config
-dontwarn com.jirbo.adcolony.**
-keep class com.jirbo.adcolony.**{*;}
混淆器说:
Proguard returned with error code 1. See console
Proguard Error 1
Output:
Unexpected error while performing partial evaluation:
Class = [com/immersion/hapticmediasdk/HapticContentSDK]
Method = [bБ04110411Б04110411()I]
Exception = [java.lang.ArrayIndexOutOfBoundsException] (-1)
java.lang.ArrayIndexOutOfBoundsException: -1
at proguard.optimize.peephole.BranchTargetFinder.visitConstantInstruction(BranchTargetFinder.java:492)
at proguard.classfile.instruction.ConstantInstruction.accept(ConstantInstruction.java:157)
at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:138)
at proguard.classfile.attribute.CodeAttribute.instructionsAccept(CodeAttribute.java:110)
at proguard.optimize.peephole.BranchTargetFinder.visitCodeAttribute(BranchTargetFinder.java:354)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:261)
at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:181)
at proguard.optimize.info.ParameterUsageMarker.visitCodeAttribute(ParameterUsageMarker.java:176)
at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
at proguard.optimize.info.ParameterUsageMarker.visitProgramMethod(ParameterUsageMarker.java:136)
at proguard.optimize.OptimizationInfoMemberFilter.visitProgramMethod(OptimizationInfoMemberFilter.java:81)
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:116)
at proguard.optimize.Optimizer.execute(Optimizer.java:341)
at proguard.ProGuard.optimize(ProGuard.java:306)
at proguard.ProGuard.execute(ProGuard.java:115)
at proguard.ProGuard.main(ProGuard.java:492)
proguard.cfg文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
# http://stackoverflow.com/questions/4525661/android-proguard-cant-find-dynamically-referenced-class-javax-swing
-dontwarn java.awt.**
-dontnote java.awt.**
-dontwarn com.badlogic.gdx.jnigen.**
-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
# Google Play Billing
-keep class com.android.vending.billing.**
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers 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 *;
}
-keepnames class com.badlogic.gdx.backends.android.AndroidInput*
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {<init>(...);}
#GOOGLE PLAY SERVICES
-keep class com.google.** { *;}
-keep interface com.google.** { *;}
-dontwarn com.google.**
-dontwarn sun.misc.Unsafe
-dontwarn com.google.common.collect.MinMaxPriorityQueue
-keepattributes *Annotation*,Signature
-keep class * extends com.google.api.client.json.GenericJson {*;}
-keep class com.google.api.services.drive.** {*;}
# AdColony
-dontwarn android.webkit.**
我做错了什么?
我不喜欢我自己找到的解决方案,但总比没有强。目前我使用的是 2.2.2版本。我开始测试这个库的早期版本,发现 2.1.3版可以正常工作。现在我的应用程序成功导出了。有时,改进会导致新bug的产生。