1

In my Android app, I am running into an exception:

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

when I obfuscate my code however, I don't run into this exception when I run the code in debug mode. I read several responses here on SO and made many edits to proguard.cfg file and this is how it looks:

-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.** { 
    *; 
}

yet I can't get past this issue. What am I doing incorrectly here? I am using jackson 2.1.2 jars

JJD
  • 50,076
  • 60
  • 203
  • 339
Anil Gorthy
  • 869
  • 3
  • 13
  • 30

2 Answers2

0

A combination of modifying the proguard config to include what has been mentioned in 'processing bean classes' as well as specifying jsonignoreproperties in the POJOs ensured that I could get past the error and create an APK w/ obfuscation.

Community
  • 1
  • 1
Anil Gorthy
  • 869
  • 3
  • 13
  • 30
  • I am running into this with a library I am using. Is it possible to get around this problem by simply telling proguard to ignore the classes which use Jackson? – boltup_im_coding Sep 07 '16 at 19:55
0

First, the information of exception are obfscate, use a Retrace tool and Proguard to read a message with original names. And publish again a message of exception.

Jose Rodriguez
  • 9,753
  • 13
  • 36
  • 52