必须在[proguard.optimize.peephole.ClassMerger]中覆盖方法,如果有人调用的话

时间:2013-04-04 12:04:17

标签: android proguard

Proguard returned with error code 1. See console
[2013-04-04 16:25:20 - ] Note: there were 157 duplicate class definitions.
[2013-04-04 16:25:20 - ] Error: Method must be overridden in [proguard.optimize.peephole.ClassMerger] if ever called

我已经尝试过在SO上找到的所有可能的解决方案。大约有2000个重复项目,现在已经下降到157个。我的项目中也有一些外部罐子。这是我的proguard.cfg文件:

-dontwarn android.support.**

-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.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-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.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}

-keepclassmembers class * implements android.os.Parcelable {
    static android.os.Parcelable$Creator CREATOR;
}

-keepclassmembers class **.R$* {
    public static <fields>;
}

-keep class com.flurry.** { *; }
-dontwarn com.flurry.**

-keep class org.apache.** { *; }
-dontwarn org.apache.**


-dump proguard/class_files.txt 
-printseeds proguard/seeds.txt 
-printusage proguard/unused.txt 
-printmapping proguard/mapping.txt 

此应用程序适用于Android 4.0 你能否告诉我这是什么原因以及如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

将我的项目的proguard配置与$ {sdk.dir} /tools/proguard/proguard-android.txt中的一个配合使用就可以了。

此错误主要发生在第三方构建系统(例如Maven)上,后者对默认程序配置不了解。

UPD:...由于默认配置的以下内容:

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize