1

在我的 Android 应用程序中,我遇到了一个异常:

java.lang.IllegalStateException: Conflicting property name definitions: 
  'keywords' (for [field com.myapp.d.q#a]) vs 'download_urls' 
  (for [method com.myapp.d.q#a(1 params)])

然而,当我混淆我的代码时,当我在调试模式下运行代码时,我不会遇到这个异常。我在这里阅读了一些关于 SO 的回复并对 proguard.cfg 文件进行了许多编辑,这就是它的外观:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
-dontwarn android.text.*
-dontwarn org.apache.commons.*
-dontwarn org.scribe.services.*
-dontwarn com.fasterxml.jackson.databind.**

# Activities, services and broadcast receivers are specified in the manifest file so they won't be automatically included
-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
-keep public class com.crittercism.**

# Hold onto the mapping.text file, it can be used to unobfuscate stack traces in the developer console using the retrace tool
-printmapping mapping.txt

# Keep line numbers so they appear in the stack trace of the developer console
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

# Custom view components might be accessed from your layout files
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

# event handlers can be specified in the layout files e.g. android:onClick="nextButton_onClick"
-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 *;
}

-keepclassmembers public class com.crittercism.* {
    *;
}

-keepnames class com.fasterxml.jackson.** { 
    *; 
}

但我无法解决这个问题。我在这里做错了什么?我正在使用杰克逊 2.1.2 罐子

4

2 回答 2

0

修改 proguard 配置以包含“处理 bean 类”中提到的内容以及在 POJO 中指定jsonignoreproperties的组合确保我可以克服错误并创建带有混淆的 APK。

于 2013-07-08T18:36:39.740 回答
0

首先,异常信息被混淆,使用Retrace工具和Proguard读取原始名称的消息。并再次发布异常消息。

于 2014-05-22T03:17:27.047 回答