2013-07-08 93 views
1

在我的Android应用程序,我遇到了一个例外:杰克逊和ProGuard的

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)]) 

但是当我混淆我的代码,我没有当我运行在调试模式下的代码运行到这个异常。我在所以这里读了几回应并做了许多编辑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.** { 
    *; 
} 

但我不能让过去这个问题。我在这里做错了什么?我正在使用jackson 2.1.2 jars

+1

使用此链接..http://proguard.sourceforge.net/index.html#manual/examples.html –

+0

@ZalaJanaksinh是的我在发布之前确实参考了这些示例,但无法找到任何确凿的解决方案。 –

回答

0

修改proguard配置以包含“处理bean类”中提及的内容以及在POJO中指定jsonignoreproperties的组合确保了我可以通过错误并创建一个APK w/obfuscation。

+0

我遇到了这个问题,我正在使用一个库。是否可以通过简单地告诉程序员忽略使用杰克逊的类来解决这个问题? –

0

首先,异常信息是obfscate,使用Retrace工具和Proguard来读取带有原始名称的消息。并再次发布异常消息。