2
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 个。我的项目中也有一些外部 jar。这是我的 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 能否请您告诉我这是什么原因造成的,以及如何修复它。

4

1 回答 1

0

将我的项目的 proguard 配置与来自 ${sdk.dir}/tools/proguard/proguard-android.txt 的配置合并就可以了。

此错误主要发生在不了解默认 proguard 配置的 3rd 方构建系统(例如 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
于 2014-12-24T08:55:23.490 回答