3

I have been looking to a solution to this problem, i have tried many proguard configurations without success. The app runs perfectly until I make the release version with proguard. I am getting the error: "java.lang.IllegalArgumentException:The class representing the mobile serviceTable must have a single id property defined" while assigning the class

I belive that is caused by the class of the table that i am trying to reach, having its variable 'id' name changed.

I have the folowing:

public class User {
   public String id;
   public String nickname;
   public String phone;
}

and the connection is made with:

mClient.getTable(User.class).where().field("nickname")
    .eq(nick).execute(new TableQueryCallback<User>() {....

the proguard config file is:

-keep class com.microsoft.azure.storage.table.** { *; }
-dontwarn com.fasterxml.jackson.core**

-keep class com.microsoft.windowsazure.mobileservices.** { *; }
-dontwarn android.os.**
-dontwarn com.microsoft.windowsazure.mobileservices.RequestAsyncTask

##---------------from here is the part that i have modified a lot of times -

-keepattributes Signature
-keepattributes *Annotation*
-keep public class com.company.app.User.** { *; }
-keepclassmembers public class com.company.app.User.** { *; }

I have tried many modifications for hours without success. I followed this and this among many others.

Can you please help me? Thanks

EDIT: solved. Just remove the .** after User in the proguard file. Leave it like this:

-keep public class com.company.app.User { *; }
-keepclassmembers public class com.company.app.User { *; }
Community
  • 1
  • 1
  • Have you tried adding the additional SerializedName line to your proguard config as mentioned in one of the linked posts comments? -keep @interface com.google.gson.annotations.SerializedName – Chris Feb 10 '15 at 15:34
  • Do you mean by putting in the class members @com.google.gson.annotations.SerializedName("id") and then adding -keepattributes *Annotation* -keep @interface com.google.gson.annotations.SerializedName ? Yes, i have tried that – user2732768 Feb 10 '15 at 15:48
  • 1
    I am checking the proguard files and in mapping.txt i can see com.company.app.User -> com.company.app.User: java.lang.String nickname -> a java.lang.String phone -> b so those are being obfuscated and in the usage.txt : public java.lang.String id so the id is not kept...I guess that there is the problem – user2732768 Feb 10 '15 at 16:01
  • I solved the problem. Just remove the .** after User in the proguard file and fixed. I can't believe i spent that much time with this thing... – user2732768 Feb 10 '15 at 16:13
  • I'd suggest adding that as an answer and accepting it so the next time someone runs into it, you'll provide them the solution :) – Chris Feb 10 '15 at 17:26

1 Answers1

2

solved. Just remove the .** after User in the proguard file. Leave it like this:

-keep public class com.company.app.User { *; }
-keepclassmembers public class com.company.app.User { *; }