Proguard java.lang.StackOverflowError

时间:2015-05-19 16:55:17

标签: java android proguard obfuscation

我试图用proguard混淆一个android项目,但是失败并出现以下错误:

 Proguard returned with error code 1. See console
[2015-05-19 18:24:31 - Volume]       You should check if you need to specify additional program jars.
[2015-05-19 18:24:31 - Volume] Exception in thread "main" java.lang.StackOverflowError
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitAnyAttribute(ClassObfuscator.java:169)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.util.SimplifiedVisitor.visitSourceFileAttribute(SimplifiedVisitor.java:251)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.SourceFileAttribute.accept(SourceFileAttribute.java:60)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java:535)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitProgramClass(ClassObfuscator.java:148)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.referencedClassAccept(EnclosingMethodAttribute.java:108)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitEnclosingMethodAttribute(ClassObfuscator.java:182)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.accept(EnclosingMethodAttribute.java:130)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java:535)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitProgramClass(ClassObfuscator.java:148)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.referencedClassAccept(EnclosingMethodAttribute.java:108)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitEnclosingMethodAttribute(ClassObfuscator.java:182)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.accept(EnclosingMethodAttribute.java:130)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java:535)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitProgramClass(ClassObfuscator.java:148)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.referencedClassAccept(EnclosingMethodAttribute.java:108)
[2015-05-19 18:24:31 - Volume]  at proguard.obfuscate.ClassObfuscator.visitEnclosingMethodAttribute(ClassObfuscator.java:182)
[2015-05-19 18:24:31 - Volume]  at proguard.classfile.attribute.EnclosingMethodAttribute.accept(EnclosingMethodAttribute.java:130)

对于具有相同错误的1000行,它会继续这样做

[更新] Proguard.cfg

-dontwarn javax.annotation.**
-dontwarn javax.inject.**
-dontwarn sun.misc.Unsafe

-keepattributes *Annotation*, EnclosingMethod, Signature, InnerClasses

-keepattributes SourceFile,LineNumberTable
-keep class org.acra.ACRA {
    *;
}
-keep class org.acra.ReportingInteractionMode {
    *;
}
-keepnames class org.acra.sender.HttpSender$** {
    *;
}
-keepnames class org.acra.ReportField {
    *;
}
-keep public class org.acra.ErrorReporter
{
    public void addCustomData(java.lang.String,java.lang.String);
    public void putCustomData(java.lang.String,java.lang.String);
    public void removeCustomData(java.lang.String);
}
-keep public class org.acra.ErrorReporter
{
    public void handleSilentException(java.lang.Throwable);
}
-keepclassmembers class ** {
    public void onEvent*(**);
}
-keep class com.android.internal.telephony.* {
  *;
}
-keep class com.example.com.IncomingCallReceiver {
  *;
}

-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }

-keepclasseswithmembernames class * {
    @butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
    @butterknife.* <methods>;
}
-keep class com.daimajia.easing.** { *; }
-keep interface com.daimajia.easing.** { *; }

-keepnames class de.devland.** { *; }
-keep class **$$Impl { public *;}
-keep class preferences.**Prefs { public *;}
  # Dagger
    -dontwarn dagger.internal.codegen.**
    -keepclassmembers,allowobfuscation class * {
        @javax.inject.* *;
        @dagger.* *;
        <init>();
    }
    -keep class dagger.* { *; }
    -keep class javax.inject.* { *; }
    -keep class * extends dagger.internal.Binding
    -keep class * extends dagger.internal.ModuleAdapter
    -keep class * extends dagger.internal.StaticInjection

我尝试了什么:

  1. 确保我已引用所有库

  2. 确保proguard.cfg

  3. 中的所有必要规则
  4. 我已经添加了所有库和相同的库     配置到一个新项目,以尝试和复制     问题而且无法解决。只有当我复制源代码时才会这样做     问题出现了,这让我觉得错误在于     源代码。但由于错误信息太模糊,我不知道     知道从哪里开始。
  5. 有人可以告诉我下一步的任何想法或我如何调试proguard吗? 谢谢!

0 个答案:

没有答案